Browse Source

feature 代码提交

xiahan 4 months ago
parent
commit
8c7ee27f84
20 changed files with 717 additions and 152 deletions
  1. 34 0
      zhsw-common/src/main/java/com/rongwei/zhsw/system/config/ThreadPoolConfig.java
  2. 128 0
      zhsw-common/src/main/java/com/rongwei/zhsw/system/importListener/MeterReadingRecordListener.java
  3. 14 0
      zhsw-common/src/main/java/com/rongwei/zhsw/system/service/ImportExcelService.java
  4. 0 2
      zhsw-common/src/main/java/com/rongwei/zhsw/system/service/SwBillManagementUnpaidService.java
  5. 237 0
      zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/BillGenerationServiceImpl.java
  6. 66 0
      zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/ImportExcelServiceImpl.java
  7. 26 20
      zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwBillManagementUnpaidServiceImpl.java
  8. 2 2
      zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwBillingRecordServiceImpl.java
  9. 2 2
      zhsw-common/src/main/java/com/rongwei/zhsw/system/utils/ZhswCommonUtils.java
  10. 2 0
      zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/AccountServiceImpl.java
  11. 4 4
      zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/RegistrationServiceImpl.java
  12. 2 3
      zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/WeChatMineServiceImpl.java
  13. 5 0
      zhsw-entity/pom.xml
  14. 44 67
      zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwBillManagementUnpaidDo.java
  15. 18 0
      zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwUserManagementDo.java
  16. 28 50
      zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwWaterUsageEntryDo.java
  17. 36 0
      zhsw-entity/src/main/java/com/rongwe/zhsw/system/vo/ImportMeterReadingRecordVo.java
  18. 37 0
      zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/BillGenerationController.java
  19. 30 0
      zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/ImportExcelController.java
  20. 2 2
      zhsw-server/src/main/resources/bootstrap-dev.yml

+ 34 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/config/ThreadPoolConfig.java

@@ -0,0 +1,34 @@
+package com.rongwei.zhsw.system.config;
+
+import cn.hutool.core.thread.ExecutorBuilder;
+import cn.hutool.core.thread.ThreadFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * ThreadPoolConfig class
+ *
+ * @author XH
+ * @date 2023/12/18
+ */
+
+@Configuration
+public class ThreadPoolConfig {
+    public static final String NAME_PRE="zhsw-";
+
+    @Bean("customThreadPool")
+    public static ThreadPoolExecutor getExecutor(){
+        return  ExecutorBuilder.create()
+                .setCorePoolSize(8)
+                .setMaxPoolSize(16)
+                .setKeepAliveTime(60, TimeUnit.SECONDS)
+                .setHandler(new ThreadPoolExecutor.CallerRunsPolicy())
+                .setAllowCoreThreadTimeOut(true)
+                .setThreadFactory(ThreadFactoryBuilder.create().setNamePrefix(NAME_PRE).build())
+                .build();
+    }
+
+}

+ 128 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/importListener/MeterReadingRecordListener.java

@@ -0,0 +1,128 @@
+package com.rongwei.zhsw.system.importListener;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.collect.Lists;
+import com.rongwe.zhsw.system.domain.SwUserManagementDo;
+import com.rongwe.zhsw.system.domain.SwWaterUsageEntryDo;
+import com.rongwe.zhsw.system.vo.ImportMeterReadingRecordVo;
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
+import com.rongwei.rwcommon.base.BaseDo;
+import com.rongwei.rwcommon.base.exception.CustomException;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import com.rongwei.zhsw.system.service.impl.SwUserManagementServiceImpl;
+import com.rongwei.zhsw.system.service.impl.SwWaterUsageEntryServiceImpl;
+import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static com.rongwei.zhsw.system.utils.ZHSWCommonUtils.getCurrentUser;
+
+/**
+ * MeterReadingRecordListener class
+ *
+ * @author XH
+ * @date 2025/03/19
+ */
+public class MeterReadingRecordListener extends AnalysisEventListener<ImportMeterReadingRecordVo> {
+    private static final Logger log = LoggerFactory.getLogger(MeterReadingRecordListener.class);
+    private List<ImportMeterReadingRecordVo> recordList = new ArrayList<>();
+
+    private SwUserManagementServiceImpl swUserManagementService;
+    private SwWaterUsageEntryServiceImpl swWaterUsageEntryService;
+
+    public MeterReadingRecordListener(SwUserManagementServiceImpl userManagementService,SwWaterUsageEntryServiceImpl waterUsageEntryService) {
+        this.swUserManagementService = userManagementService;
+        this.swWaterUsageEntryService = waterUsageEntryService;
+    }
+
+    @Override
+    public void invoke(ImportMeterReadingRecordVo importMeterReadingRecordVo, AnalysisContext analysisContext) {
+
+        if (StringUtils.isBlank(importMeterReadingRecordVo.getAccountNumber())) {
+            throw new CustomException("户号为空");
+        }
+        if (importMeterReadingRecordVo.getReadingDate() == null) {
+            throw new CustomException("抄表日期");
+        }
+        if (importMeterReadingRecordVo.getConsumption() == null) {
+            throw new CustomException("读数为空");
+        }
+        // 校验当前睡觉是否存在抄表记录
+        int count = swWaterUsageEntryService.count(new LambdaQueryWrapper<SwWaterUsageEntryDo>()
+                .eq(BaseDo::getDeleted, "0")
+                .eq(SwWaterUsageEntryDo::getUsernumber, importMeterReadingRecordVo.getAccountNumber())
+                .eq(SwWaterUsageEntryDo::getCurrentreadingdate, importMeterReadingRecordVo.getReadingDate()));
+        if(count==0) {
+            recordList.add(importMeterReadingRecordVo);
+        }
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+        if(recordList.isEmpty()){
+            return;
+        }
+        List<String> accountNumList = recordList.stream().map(ImportMeterReadingRecordVo::getAccountNumber).distinct().collect(Collectors.toList());
+        List<SwUserManagementDo> allAccountData = new ArrayList<>();
+        Lists.partition(accountNumList,5000).forEach(accountNum -> {
+            allAccountData.addAll(swUserManagementService.list(new LambdaQueryWrapper<SwUserManagementDo>()
+                    .eq(BaseDo::getDeleted, "0")
+                    .in(SwUserManagementDo::getUsernumber, accountNumList)));
+        });
+        SysUserVo currentUser = getCurrentUser();
+        List<SwWaterUsageEntryDo> saveList= new ArrayList<>();
+        Calendar calendar = Calendar.getInstance();
+        recordList.forEach(record->{
+            SwUserManagementDo swUserManagementDo = allAccountData.stream().filter(accountInfo -> accountInfo.getUsernumber().equals(record.getAccountNumber()))
+                    .findFirst()
+                    .orElse(null);
+            SwWaterUsageEntryDo swWaterUsageEntryDo = new SwWaterUsageEntryDo();
+            if(swUserManagementDo!=null){
+                // 如果时间一致不让当如
+                if(record.getReadingDate().equals(swUserManagementDo.getLastmeterreaddate())){
+                    log.error("本次抄表日期和最后一次抄表日期一致");
+                    return;
+                }
+                swWaterUsageEntryDo.setAddress(swUserManagementDo.getAddress());
+                swWaterUsageEntryDo.setUsername(swUserManagementDo.getUsername());
+                swWaterUsageEntryDo.setUserid(swUserManagementDo.getId());
+                swWaterUsageEntryDo.setState(0);
+                swWaterUsageEntryDo.setLastreading(swUserManagementDo.getLastmeterreading());
+                swWaterUsageEntryDo.setLastreadingdate(swUserManagementDo.getLastmeterreaddate());
+                swWaterUsageEntryDo.setCommunityname(swUserManagementDo.getVillagename());
+                swWaterUsageEntryDo.setCommunitycode(swUserManagementDo.getVolumeno());
+            }else{
+                swWaterUsageEntryDo.setState(2);
+            }
+            calendar.setTime(record.getReadingDate());
+            swWaterUsageEntryDo.setId(SecurityUtil.getUUID());
+            swWaterUsageEntryDo.setUsernumber(record.getAccountNumber());
+            swWaterUsageEntryDo.setThisreading(record.getConsumption());
+
+            swWaterUsageEntryDo.setCurrentreadingdate(record.getReadingDate());
+            swWaterUsageEntryDo.setReadingsource("1");
+
+            swWaterUsageEntryDo.setYear(calendar.get(Calendar.YEAR));
+            swWaterUsageEntryDo.setMonth(calendar.get(Calendar.MONTH)+1);
+            swWaterUsageEntryDo.setIsds(String.valueOf(0));
+            ZHSWCommonUtils.initModelGeneralParameters(swWaterUsageEntryDo,currentUser);
+            saveList.add(swWaterUsageEntryDo);
+        });
+        save(saveList);
+    }
+    @Transactional
+    public void save(List<SwWaterUsageEntryDo> saveList){
+        if(!saveList.isEmpty()){
+            swWaterUsageEntryService.saveBatch(saveList,500);
+        }
+    }
+}

+ 14 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/ImportExcelService.java

@@ -0,0 +1,14 @@
+package com.rongwei.zhsw.system.service;
+
+import com.rongwei.rwcommon.base.R;
+
+/**
+ * ImportExcelService class
+ *
+ * @author XH
+ * @date 2025/03/19
+ */
+public interface ImportExcelService {
+
+    R meterReadingRecord(String fileId);
+}

+ 0 - 2
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/SwBillManagementUnpaidService.java

@@ -13,7 +13,5 @@ import com.rongwei.rwcommon.base.R;
  */
 public interface SwBillManagementUnpaidService extends IService<SwBillManagementUnpaidDo> {
 
-
-
     R meterReadingCorrection(MeterReadingCorrectionDTO dto);
 }

+ 237 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/BillGenerationServiceImpl.java

@@ -0,0 +1,237 @@
+package com.rongwei.zhsw.system.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.rongwe.zhsw.system.domain.SwBillManagementUnpaidDo;
+import com.rongwe.zhsw.system.domain.SwUserManagementDo;
+import com.rongwe.zhsw.system.domain.SwWaterUsageEntryDo;
+import com.rongwei.rwcommon.base.BaseDo;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static org.springframework.transaction.annotation.Propagation.REQUIRED;
+
+/**
+ * BillGenerationServiceImpl class
+ *
+ * @author XH
+ * @date 2025/03/18
+ */
+@Component
+public class BillGenerationServiceImpl {
+    private static final Logger log = LoggerFactory.getLogger(BillGenerationServiceImpl.class);
+
+    @Autowired
+    private SwWaterUsageEntryServiceImpl swWaterUsageEntryService;
+    @Autowired
+    private SwUserManagementServiceImpl swUserManagementService;
+    @Autowired
+    private SwBillManagementUnpaidServiceImpl swBillManagementUnpaidService;
+
+    private static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+
+    public static String formatDate(Date date) {
+        synchronized (formatter) {
+            return formatter.format(date);
+        }
+    }
+
+    public void generateBill(List<SwWaterUsageEntryDo> swWaterUsageEntryDoList) {
+        log.info("开始生成账单信息");
+        if (swWaterUsageEntryDoList == null || swWaterUsageEntryDoList.isEmpty()) {
+            log.error("暂无需要生成账单的信息");
+            return;
+        }
+        // 对数据按照抄表日期排序
+        List<SwWaterUsageEntryDo> collect = swWaterUsageEntryDoList.stream()
+                .sorted(Comparator.comparing(SwWaterUsageEntryDo::getCurrentreadingdate))
+                .collect(Collectors.toList());
+
+        List<SwWaterUsageEntryDo> saveUsageEntryList = new ArrayList<>();
+        List<SwBillManagementUnpaidDo> saveList = new ArrayList<>();
+        List<SwUserManagementDo> userSaveList = new ArrayList<>();
+        collect.forEach(swWaterUsageEntry -> {
+            String usernumber = swWaterUsageEntry.getUsernumber();
+            // 本次抄表日期
+            Date currentreadingdate = swWaterUsageEntry.getCurrentreadingdate();
+            // 校验 是否已存在抄表记录
+            if (swWaterUsageEntry.getState() != 0) {
+                log.error("当前用户:{},时间:{}的抄表记录已生成账单信息", usernumber, currentreadingdate);
+                return;
+            }
+
+            SwUserManagementDo swUserManagementDo = swUserManagementService.getOne(new LambdaQueryWrapper<SwUserManagementDo>()
+                    .select(SwUserManagementDo::getId,
+                            SwUserManagementDo::getUsernumber,
+                            SwUserManagementDo::getMetermaxvalue,
+                            SwUserManagementDo::getWaterprice,
+                            SwUserManagementDo::getVillagename,
+                            SwUserManagementDo::getUsernumber,
+                            SwUserManagementDo::getUsername,
+                            SwUserManagementDo::getUsertype,
+                            SwUserManagementDo::getAddress,
+                            SwUserManagementDo::getExemptionamount,
+                            SwUserManagementDo::getExemptionwater,
+                            SwUserManagementDo::getWatertype,
+                            SwUserManagementDo::getLastmeterreaddate,
+                            SwUserManagementDo::getLastmeterreading
+                    )
+                    .eq(BaseDo::getDeleted, "0")
+                    .eq(SwUserManagementDo::getUsernumber, usernumber));
+            SwWaterUsageEntryDo usageEntryDo = new SwWaterUsageEntryDo();
+            usageEntryDo.setId(swWaterUsageEntry.getId());
+            if (swUserManagementDo == null) {
+                log.error("当前户号不存在");
+                usageEntryDo.setState(2);
+                saveUsageEntryList.add(usageEntryDo);
+                return;
+            }
+
+            // 校验是否可以生成账单
+            if (swUserManagementDo.getLastmeterreaddate() != null &&
+                    swUserManagementDo.getLastmeterreaddate().compareTo(swWaterUsageEntry.getCurrentreadingdate()) > 0) {
+                log.error("本次抄表日期:{}小于用户表最后一次抄表日期:{}", swUserManagementDo.getLastmeterreaddate(), swWaterUsageEntry.getCurrentreadingdate());
+                usageEntryDo.setState(3);
+                saveUsageEntryList.add(usageEntryDo);
+                return;
+            }
+            SwBillManagementUnpaidDo swBillManagementUnpaidDo=null;
+            try {
+                // 生成代缴费账单
+                swBillManagementUnpaidDo= produceBill(swUserManagementDo, swWaterUsageEntry);
+            }catch (Exception e) {
+                log.error("缴费记录生成失败原因:{}",e.getMessage());
+            }
+
+            if(swBillManagementUnpaidDo==null){
+                usageEntryDo.setState(4);
+            }else{
+                usageEntryDo.setState(1);
+                saveList.add(swBillManagementUnpaidDo);
+                // 设置本次的抄表日期
+                swUserManagementDo.setLastmeterreaddate(swBillManagementUnpaidDo.getThismeterreadingdate());
+                // 设置本次的抄表用量
+                swUserManagementDo.setLastmeterreading(swBillManagementUnpaidDo.getLastmeterreading());
+            }
+            userSaveList.add(swUserManagementDo);
+            saveUsageEntryList.add(usageEntryDo);
+        });
+        dataSave(saveList, userSaveList, saveUsageEntryList);
+    }
+
+
+    public void generateBill(String id) {
+        SwWaterUsageEntryDo swWaterUsageEntryDo = swWaterUsageEntryService.getById(id);
+        this.generateBill(Collections.singletonList(swWaterUsageEntryDo));
+    }
+
+    public void generateBill(List<String> ids, boolean a) {
+        if (ids.isEmpty()) {
+            log.error("抄表记录ID为空");
+            return;
+        }
+        this.generateBill(swWaterUsageEntryService.getBaseMapper().selectBatchIds(ids));
+    }
+
+    public void generateBill() {
+        List<SwWaterUsageEntryDo> list = swWaterUsageEntryService.list(new LambdaQueryWrapper<SwWaterUsageEntryDo>()
+                .eq(SwWaterUsageEntryDo::getDeleted, "0")
+                .eq(SwWaterUsageEntryDo::getState, 0));
+        this.generateBill(list);
+    }
+
+    /**
+     * 数据保存
+     * @param swBillManagementUnpaidDos 账单信息
+     * @param userSaveList  用户信息
+     * @param saveUsageEntryList 抄表记录
+     */
+    @Transactional(rollbackFor = Exception.class, propagation = REQUIRED)
+    public void dataSave(List<SwBillManagementUnpaidDo> swBillManagementUnpaidDos, List<SwUserManagementDo> userSaveList,
+                         List<SwWaterUsageEntryDo> saveUsageEntryList) {
+        swWaterUsageEntryService.updateBatchById(saveUsageEntryList,4000);
+        // 账单保存
+        swBillManagementUnpaidService.saveBatch(swBillManagementUnpaidDos, 1000);
+        // 更新用户表的本次抄表时间和本次抄表度数lll
+        swUserManagementService.updateBatchById(userSaveList);
+    }
+
+
+    /**
+     * 生成账单
+     *
+     * @return
+     */
+    public SwBillManagementUnpaidDo produceBill(SwUserManagementDo swUserManagementDo, SwWaterUsageEntryDo swWaterUsageEntryDo) {
+        // 上次抄表数
+        BigDecimal lastreading = swWaterUsageEntryDo.getLastreading();
+        // 本次抄表数
+        BigDecimal thisreading = swWaterUsageEntryDo.getThisreading();
+
+        //当前用水
+        BigDecimal waterConsumption;
+        // 本次大于上次
+        if (thisreading.compareTo(lastreading) >= 0) {
+            waterConsumption = thisreading.subtract(lastreading);
+        } else {
+            // 本次抄表数小于上次抄表数 用表具的最大值-上次抄表数+本次抄表数
+            waterConsumption = swUserManagementDo.getMetermaxvalue().subtract(lastreading).add(thisreading);
+        }
+        // 获取水价
+        BigDecimal waterprice = swUserManagementDo.getWaterprice();
+        Date currentreadingdate = swWaterUsageEntryDo.getCurrentreadingdate();
+        // 账单实例
+        SwBillManagementUnpaidDo swBillManagementUnpaidDo = new SwBillManagementUnpaidDo();
+        swBillManagementUnpaidDo.setId(SecurityUtil.getUUID());
+
+        String dateStr = formatDate(currentreadingdate);
+        // 抄表日期+-+户号
+        swBillManagementUnpaidDo.setBillnumber(dateStr + "-" + swWaterUsageEntryDo.getUsernumber());
+        swBillManagementUnpaidDo.setYear(Integer.parseInt(dateStr.substring(0, 4)));
+        swBillManagementUnpaidDo.setMonth(Integer.parseInt(dateStr.substring(5, 7)));
+        swBillManagementUnpaidDo.setVillagename(swUserManagementDo.getVillagename());
+        swBillManagementUnpaidDo.setUsernumber(swUserManagementDo.getUsernumber());
+        swBillManagementUnpaidDo.setUsername(swUserManagementDo.getUsername());
+        swBillManagementUnpaidDo.setUsertype(swUserManagementDo.getUsertype());
+        swBillManagementUnpaidDo.setAddress(swUserManagementDo.getAddress());
+        swBillManagementUnpaidDo.setUnitprice(waterprice);
+        swBillManagementUnpaidDo.setCurrentwateruse(waterConsumption);
+
+        //减免计算方式减免金额
+        BigDecimal exemptionAmount = swUserManagementDo.getExemptionamount() == null ? BigDecimal.ZERO : swUserManagementDo.getExemptionamount();
+        // 减免用水
+        BigDecimal exemptionWater = swUserManagementDo.getExemptionwater() == null ? BigDecimal.ZERO : swUserManagementDo.getExemptionwater();
+        // 优先金额减免
+        if (exemptionAmount.compareTo(BigDecimal.ZERO) > 0) {
+            // 计算减免用水
+            exemptionWater = exemptionAmount.divide(waterprice, 2, RoundingMode.HALF_UP);
+        } else {
+            exemptionAmount = exemptionWater.multiply(waterprice);
+        }
+        swBillManagementUnpaidDo.setReducedwateruse(exemptionWater);
+        swBillManagementUnpaidDo.setFeewaiver(exemptionAmount);
+        swBillManagementUnpaidDo.setOughttohavepaid(waterprice.multiply(waterConsumption));
+        swBillManagementUnpaidDo.setWatertype(swUserManagementDo.getWatertype());
+        // 实际应缴=原应缴-减免
+        swBillManagementUnpaidDo.setActualdue(swBillManagementUnpaidDo.getOughttohavepaid().subtract(swBillManagementUnpaidDo.getFeewaiver()));
+        swBillManagementUnpaidDo.setLastmeterreadingdate(swWaterUsageEntryDo.getLastreadingdate());
+        swBillManagementUnpaidDo.setLastmeterreading(swWaterUsageEntryDo.getLastreading());
+        swBillManagementUnpaidDo.setThismeterreadingdate(swWaterUsageEntryDo.getCurrentreadingdate());
+        swBillManagementUnpaidDo.setThismeterreading(swWaterUsageEntryDo.getThisreading());
+        swBillManagementUnpaidDo.setStatus(1 + "");
+        ZHSWCommonUtils.initModelGeneralParameters(swBillManagementUnpaidDo, null);
+        swBillManagementUnpaidDo.setWaterusageid(swWaterUsageEntryDo.getId());
+        return swBillManagementUnpaidDo;
+    }
+
+}

+ 66 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/ImportExcelServiceImpl.java

@@ -0,0 +1,66 @@
+package com.rongwei.zhsw.system.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.rongwe.zhsw.system.vo.ImportMeterReadingRecordVo;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.base.exception.CustomException;
+import com.rongwei.rwcommoncomponent.file.dao.SysFileItemDao;
+import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
+import com.rongwei.zhsw.system.importListener.MeterReadingRecordListener;
+import com.rongwei.zhsw.system.service.ImportExcelService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable;
+import org.apache.poi.xssf.eventusermodel.XSSFReader;
+import org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+import java.io.File;
+
+import static com.rongwei.rwcommon.utils.UtilsChecks.parameterCheck;
+
+/**
+ * ImportExcelServiceImpl class
+ *
+ * @author XH
+ * @date 2025/03/19
+ */
+@Service
+public class ImportExcelServiceImpl implements ImportExcelService {
+    @Autowired
+    private SysFileItemDao sysFileItemDao;
+    @Autowired
+    private SwUserManagementServiceImpl userManagementService;
+    @Autowired
+    private SwWaterUsageEntryServiceImpl waterUsageEntryService;
+    /**
+     * 抄表记录生成
+     * @param fileId
+     * @return
+     */
+    @Override
+    public R meterReadingRecord(String fileId) {
+        File file = readFile(fileId);
+        EasyExcel.read(file, ImportMeterReadingRecordVo.class,new MeterReadingRecordListener(userManagementService,waterUsageEntryService)).sheet().doRead();
+        return R.ok();
+    }
+
+    public File readFile(String fileId) {
+        parameterCheck(() -> StringUtils.isBlank(fileId), "请上传文件", "文件ID为空");
+        SysFileItemDo fileItemDo = sysFileItemDao.selectById(fileId);
+        parameterCheck(() -> fileItemDo == null, "文件解析有误!请联系管理员", "无法根据文件ID:{},获取到文件信息", fileId);
+        String fileName = fileItemDo.getFilename();
+        String realPath = fileItemDo.getFullpath();
+        String fileType = fileItemDo.getFiletype();
+        parameterCheck(() -> StringUtils.isBlank(realPath), "文件解析有误!请联系管理员", "根据文件ID:{},无法获取到文件路径", fileId);
+        File file = new File(realPath);
+        parameterCheck(() -> !file.exists(), "文件解析有误!请联系管理员", "根据文件地址:{},无法获取文件", realPath);
+        return file;
+    }
+}

+ 26 - 20
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwBillManagementUnpaidServiceImpl.java

@@ -1,6 +1,7 @@
 package com.rongwei.zhsw.system.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwe.zhsw.system.domain.SwBillManagementUnpaidDo;
 import com.rongwe.zhsw.system.domain.SwMeterReadingCorrectionDo;
@@ -8,6 +9,7 @@ import com.rongwe.zhsw.system.domain.SwUserManagementDo;
 import com.rongwe.zhsw.system.domain.SwWaterUsageEntryDo;
 import com.rongwe.zhsw.system.dto.MeterReadingCorrectionDTO;
 import com.rongwei.rwadmincommon.system.vo.SysUserVo;
+import com.rongwei.rwcommon.base.BaseDo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.zhsw.system.dao.SwBillManagementUnpaidDao;
@@ -15,7 +17,7 @@ import com.rongwei.zhsw.system.service.SwBillManagementUnpaidService;
 import com.rongwei.zhsw.system.service.SwUserManagementService;
 import com.rongwei.zhsw.system.service.SwMeterReadingCorrectionService;
 import com.rongwei.zhsw.system.service.SwWaterUsageEntryService;
-import com.rongwei.zhsw.system.utils.ZhswCommonUtils;
+import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -69,40 +71,44 @@ public class SwBillManagementUnpaidServiceImpl extends ServiceImpl<SwBillManagem
         BigDecimal thisMeterReading = dto.getThisMeterReading();
 
         //当前用户
-        SysUserVo currentUser = ZhswCommonUtils.getCurrentUser();
+        SysUserVo currentUser = ZHSWCommonUtils.getCurrentUser();
 
         //1. 更新抄表数据
         SwWaterUsageEntryDo swWaterUsageEntryDo = swWaterUsageEntryService.getBaseMapper().selectById(meterReadId);
 
         BigDecimal oldreading = swWaterUsageEntryDo.getThisreading();
-        swWaterUsageEntryDo.setThisreading(thisMeterReading)
-                .setModifyuserid(currentUser.getId()).setModifyusername(currentUser.getName()).setModifydate(new Date());
-
+        SwWaterUsageEntryDo waterUsageUpdateDo= new SwWaterUsageEntryDo();
+        waterUsageUpdateDo.setThisreading(thisMeterReading);
+        waterUsageUpdateDo.setModifyuserid(currentUser.getId());
+        waterUsageUpdateDo.setModifyusername(currentUser.getName());
+        waterUsageUpdateDo.setModifydate(new Date());
         swWaterUsageEntryService.updateById(swWaterUsageEntryDo);
 
         //2. 根据抄表户号查询用户修改最近读表数
         SwUserManagementDo swUserManagement = swUserManagementService.getBaseMapper()
                 .selectOne(new LambdaQueryWrapper<SwUserManagementDo>()
                 .eq(SwUserManagementDo::getUsernumber, swWaterUsageEntryDo.getUsernumber()));
-        swUserManagement.setLastmeterreading(thisMeterReading);
-        swUserManagement.setModifyuserid(currentUser.getId());
-        swUserManagement.setModifyusername(currentUser.getName());
-        swUserManagement.setModifydate(new Date());
-        swUserManagementService.updateById(swUserManagement);
+        SwUserManagementDo updateDo= new SwUserManagementDo();
+        updateDo.setLastmeterreading(thisMeterReading);
+        updateDo.setModifyuserid(currentUser.getId());
+        updateDo.setModifyusername(currentUser.getName());
+        updateDo.setModifydate(new Date());
+        updateDo.setId(swUserManagement.getId());
+        swUserManagementService.updateById(updateDo);
 
         //更新账户表
         SwBillManagementUnpaidDo unpaidDo = swBillManagementUnpaidService.getBaseMapper().selectById(billId);
-        //【本次抄表数】对应更新
-        unpaidDo.setThismeterreading(thisMeterReading);
         //【当期用水量】=【更新后本次抄表数】-【上次抄表数】
-        unpaidDo.setCurrentwateruse(thisMeterReading.subtract(unpaidDo.getLastmeterreading() == null ? BigDecimal.ZERO : unpaidDo.getLastmeterreading()));
-        //【原应缴】=【单价】*【当期用水量】
-        unpaidDo.setOughttohavepaid(unpaidDo.getUnitprice().multiply(unpaidDo.getCurrentwateruse()));
-        //更新未已修正状态
-        unpaidDo.setMeterreadingcorrectionstatus(HAVEREVISEDSTATUS)
-                .setModifyuserid(currentUser.getId()).setModifyusername(currentUser.getName()).setModifydate(new Date());
-
-        swBillManagementUnpaidService.updateById(unpaidDo);
+        BigDecimal currentUsing = thisMeterReading.subtract(unpaidDo.getLastmeterreading() == null ? BigDecimal.ZERO : unpaidDo.getLastmeterreading());
+        swBillManagementUnpaidService.update(new LambdaUpdateWrapper<SwBillManagementUnpaidDo>()
+                .eq(SwBillManagementUnpaidDo::getId,billId)
+                .set(SwBillManagementUnpaidDo::getThismeterreading,thisMeterReading)
+                .set(SwBillManagementUnpaidDo::getCurrentwateruse,currentUsing)
+                .set(SwBillManagementUnpaidDo::getOughttohavepaid,unpaidDo.getUnitprice().multiply(currentUsing))
+                .set(SwBillManagementUnpaidDo::getMeterreadingcorrectionstatus,HAVEREVISEDSTATUS)
+                .set(BaseDo::getModifyuserid,currentUser.getId())
+                .set(BaseDo::getModifyusername,currentUser.getName())
+                .set(BaseDo::getModifydate,new Date()));
 
         //生成新的抄表修正记录
         SwMeterReadingCorrectionDo swMeterReadingCorrectionDo = new SwMeterReadingCorrectionDo();

+ 2 - 2
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwBillingRecordServiceImpl.java

@@ -16,7 +16,7 @@ import com.rongwei.zhsw.system.service.SwBillManagementPaidService;
 import com.rongwei.zhsw.system.service.SwBillManagementUnpaidService;
 import com.rongwei.zhsw.system.service.SwBillingRecordService;
 import com.rongwei.zhsw.system.service.SwUserManagementService;
-import com.rongwei.zhsw.system.utils.ZhswCommonUtils;
+import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -114,7 +114,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
         CreateBillingNumber(add);
 
         //当前用户
-        SysUserVo currentUser = ZhswCommonUtils.getCurrentUser();
+        SysUserVo currentUser = ZHSWCommonUtils.getCurrentUser();
         add.setTollcollectorid(currentUser.getId());
         add.setTollcollectorname(currentUser.getName());
         add.setTenantid(currentUser.getTenantid())

+ 2 - 2
zhsw-common/src/main/java/com/rongwei/zhsw/system/utils/ZhswCommonUtils.java

@@ -32,8 +32,8 @@ import java.util.function.Function;
  * @date 2023/12/15
  */
 @Component
-public class ZhswCommonUtils {
-    private static final Logger log = LoggerFactory.getLogger(ZhswCommonUtils.class.getName());
+public class ZHSWCommonUtils {
+    private static final Logger log = LoggerFactory.getLogger(ZHSWCommonUtils.class.getName());
     @Autowired
     private RedisService autoRedisService;
     @Autowired

+ 2 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/AccountServiceImpl.java

@@ -118,6 +118,8 @@ public class AccountServiceImpl implements AccountService {
      */
     @Override
     public R changeDefaultAccount(AccountBindVo accountBindVo) {
+
+
         return null;
     }
 

+ 4 - 4
zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/RegistrationServiceImpl.java

@@ -14,7 +14,7 @@ import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
 import com.rongwei.zhsw.system.service.impl.SwFeedBackOpinionServiceImpl;
 import com.rongwei.zhsw.system.service.impl.SwUserRepairServiceImpl;
 import com.rongwei.zhsw.system.wechat.RegistrationService;
-import com.rongwei.zhsw.system.utils.ZhswCommonUtils;
+import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,8 +25,8 @@ import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
-import static com.rongwei.zhsw.system.utils.ZhswCommonUtils.initModelGeneralParameters;
-import static com.rongwei.zhsw.system.utils.ZhswCommonUtils.uniqueSign;
+import static com.rongwei.zhsw.system.utils.ZHSWCommonUtils.initModelGeneralParameters;
+import static com.rongwei.zhsw.system.utils.ZHSWCommonUtils.uniqueSign;
 
 /**
  * RegistrationServiceImpl class
@@ -61,7 +61,7 @@ public class RegistrationServiceImpl implements RegistrationService {
         swUserRepairDo.setAddress(weChatRepairReportVo.getAddress());
         swUserRepairDo.setContact(weChatRepairReportVo.getContact());
         swUserRepairDo.setRepairtype(weChatRepairReportVo.getRepairType());
-        ZhswCommonUtils.replaceSysDictMethod(swUserRepairDo, SwUserRepairDo::getRepairtype, SwUserRepairDo::setRepairtype,
+        ZHSWCommonUtils.replaceSysDictMethod(swUserRepairDo, SwUserRepairDo::getRepairtype, SwUserRepairDo::setRepairtype,
                 "repair_management_report_type");
         swUserRepairDo.setRepairsource("2");
         swUserRepairDo.setIscompleted("2");

+ 2 - 3
zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/WeChatMineServiceImpl.java

@@ -5,11 +5,10 @@ import com.rongwe.zhsw.system.domain.SwFeedBackOpinionDo;
 import com.rongwe.zhsw.system.domain.SwUserRepairDo;
 import com.rongwei.rwcommon.base.BaseDo;
 import com.rongwei.rwcommon.base.R;
-import com.rongwei.rwcommoncomponent.file.service.impl.SysFileItemServiceImpl;
 import com.rongwei.zhsw.system.service.impl.SwFeedBackOpinionServiceImpl;
 import com.rongwei.zhsw.system.service.impl.SwUserRepairServiceImpl;
 import com.rongwei.zhsw.system.utils.WeChatUtils;
-import com.rongwei.zhsw.system.utils.ZhswCommonUtils;
+import com.rongwei.zhsw.system.utils.ZHSWCommonUtils;
 import com.rongwei.zhsw.system.wechat.WeChatMineService;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,7 +50,7 @@ public class WeChatMineServiceImpl implements WeChatMineService {
             data.setImages(imgIds);
         });
         // 数据字典切换
-        ZhswCommonUtils.replaceSysDictMethod(list,SwUserRepairDo::getRepairtype,SwUserRepairDo::setRepairtype,"repair_management_report_type");
+        ZHSWCommonUtils.replaceSysDictMethod(list,SwUserRepairDo::getRepairtype,SwUserRepairDo::setRepairtype,"repair_management_report_type");
 
         return R.ok(list);
     }

+ 5 - 0
zhsw-entity/pom.xml

@@ -12,6 +12,11 @@
     <artifactId>zhsw-entity</artifactId>
 
     <dependencies>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.0.5</version> <!-- 确保使用最新版本 -->
+        </dependency>
         <dependency>
             <groupId>com.rongwei</groupId>
             <artifactId>rw-common-config</artifactId>

+ 44 - 67
zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwBillManagementUnpaidDo.java

@@ -1,6 +1,7 @@
 package com.rongwe.zhsw.system.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -19,169 +20,145 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @TableName("sw_bill_management_unpaid")
-public class SwBillManagementUnpaidDo implements Serializable {
+public class SwBillManagementUnpaidDo extends BaseDo implements Serializable {
     private static final long serialVersionUID = -66298835868317923L;
-/**
+    /**
      * 主键
      */
     private String id;
-/**
+    /**
      * 租户ID
      */
     private String tenantid;
-/**
+    /**
      * 扩展json格式配置
      */
     private String roption;
-/**
-     * 是否删除Y/N
-     */
-    private String deleted;
-/**
-     * 备注
-     */
-    private String remark;
-/**
-     * 创建时间
-     */
-    private Date createdate;
-/**
-     * 创建用户ID
-     */
-    private String createuserid;
-/**
-     * 修改日期
-     */
-    private Date modifydate;
-/**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-/**
-     * 创建人
-     */
-    private String createusername;
-/**
-     * 修改人
-     */
-    private String modifyusername;
-/**
+
+    /**
      * 账单编号
      */
     private String billnumber;
-/**
+    /**
      * 年
      */
     private Integer year;
-/**
+    /**
      * 月
      */
     private Integer month;
-/**
+    /**
      * 小区/村落/街道名称
      */
     private String villagename;
-/**
+    /**
      * 户号
      */
     private String usernumber;
-/**
+    /**
      * 户名
      */
     private String username;
-/**
+    /**
      * 用户类别
      */
     private String usertype;
-/**
+    /**
      * 详细地址
      */
     private String address;
-/**
+    /**
      * 单价(元)
      */
     private BigDecimal unitprice;
-/**
+    /**
      * 当期用水(t)
      */
     private BigDecimal currentwateruse;
-/**
+    /**
      * 减免用水(t)
      */
     private BigDecimal reducedwateruse;
-/**
+    /**
      * 减免费用
-(元)
+     * (元)
      */
     private BigDecimal feewaiver;
-/**
+    /**
      * 原应缴
-(元)
+     * (元)
      */
     private BigDecimal oughttohavepaid;
-/**
+    /**
      * 用水类型
      */
     private String watertype;
-/**
+    /**
      * 实际应缴
-(元)
+     * (元)
      */
     private BigDecimal actualdue;
-/**
+    /**
      * 上次抄表日期
      */
     private Date lastmeterreadingdate;
-/**
+    /**
      * 上次抄表数(t)
      */
     private BigDecimal lastmeterreading;
-/**
+    /**
      * 本次抄表日期
      */
     private Date thismeterreadingdate;
-/**
+    /**
      * 本次抄表数(t)
      */
     private BigDecimal thismeterreading;
-/**
+    /**
      * 状态(预收,未缴,实缴,退款)
      */
     private String status;
-/**
+    /**
      * 缴费记录ID
      */
+    @Deprecated
     private String paymentrecordid;
-/**
+    /**
      * 开票状态
      */
+    @Deprecated
     private String invoicestatus;
-/**
+    /**
      * 票据状态
      */
+    @Deprecated
     private String billstatus;
-/**
+    /**
      * 发票附件
      */
+    @Deprecated
     private String invoicefiles;
-/**
+    /**
      * 滞纳金
      */
+    @Deprecated
     private BigDecimal latefees;
-/**
+    /**
      * 退款金额
      */
+    @Deprecated
     private BigDecimal refundamount;
-/**
+    /**
      * 余额划扣金额
      */
+    @Deprecated
     private BigDecimal balancedebitamount;
     /**
      * 抄表修正状态
      */
     private String meterreadingcorrectionstatus;
 
-
+    private String waterusageid;
 
 }
 

+ 18 - 0
zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwUserManagementDo.java

@@ -105,4 +105,22 @@ public class SwUserManagementDo extends BaseDo {
      * 最后一次抄表读数
      */
     private BigDecimal lastmeterreading;
+    /**
+     * 表具的最大值
+     */
+    private BigDecimal metermaxvalue;
+    /**
+     * 当前用户的 水价
+     */
+    private BigDecimal waterprice;
+
+
+    /**
+     * 减免用水
+     */
+    private BigDecimal exemptionwater;
+    /**
+     * 减免金额
+     */
+    private BigDecimal exemptionamount;
 }

+ 28 - 50
zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwWaterUsageEntryDo.java

@@ -1,6 +1,7 @@
 package com.rongwe.zhsw.system.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -19,109 +20,86 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @TableName("sw_water_usage_entry")
-public class SwWaterUsageEntryDo implements Serializable {
+public class SwWaterUsageEntryDo extends BaseDo implements Serializable {
     private static final long serialVersionUID = 478239245134424500L;
-/**
+    /**
      * 主键
      */
     private String id;
-/**
+    /**
      * 租户ID
      */
     private String tenantid;
-/**
+    /**
      * 扩展json格式配置
      */
     private String roption;
-/**
-     * 是否删除Y/N
-     */
-    private String deleted;
-/**
-     * 备注
-     */
-    private String remark;
-/**
-     * 创建时间
-     */
-    private Date createdate;
-/**
-     * 创建用户ID
-     */
-    private String createuserid;
-/**
-     * 修改日期
-     */
-    private Date modifydate;
-/**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-/**
-     * 创建人
-     */
-    private String createusername;
-/**
-     * 修改人
-     */
-    private String modifyusername;
-/**
+
+    /**
      * 户号
      */
     private String usernumber;
-/**
+    /**
      * 户名
      */
     private String username;
-/**
+    /**
      * 本次读数
      */
     private BigDecimal thisreading;
-/**
+    /**
      * 小区/村落/街道名称(册号)
      */
     private String communityname;
-/**
+    /**
      * 地址
      */
     private String address;
-/**
+    /**
      * 本次抄表日期
      */
     private Date currentreadingdate;
-/**
+    /**
      * 抄表来源
      */
     private String readingsource;
-/**
+    /**
      * 户号表主键
      */
     private String userid;
-/**
+    /**
      * 附件
      */
     private String file;
-/**
+    /**
      * 册号编码
      */
     private String communitycode;
-/**
+    /**
      * 年
      */
     private Integer year;
-/**
+    /**
      * 月
      */
     private Integer month;
-/**
+    /**
      * 上次读数
      */
     private BigDecimal lastreading;
-/**
+    /**
      * 上次抄表日期
      */
     private Date lastreadingdate;
 
+    /**
+     * 状态(是否已生成账单 0,1)
+     */
+    private int state;
+    /**
+     * 是否为底数
+     */
+    private String isds;
 
 }
 

+ 36 - 0
zhsw-entity/src/main/java/com/rongwe/zhsw/system/vo/ImportMeterReadingRecordVo.java

@@ -0,0 +1,36 @@
+package com.rongwe.zhsw.system.vo;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * ImportMeterReadingRecordVo class
+ *
+ * @author XH
+ * @date 2025/03/19
+ */
+@Data
+public class ImportMeterReadingRecordVo {
+    /**
+     * 册号
+     */
+    @ExcelProperty(index = 0)
+    private String volumeNumber;
+    /**
+     * 户号
+     */
+    @ExcelProperty(index = 1)
+    private String accountNumber;
+    /**
+     * 度数
+     */
+    @ExcelProperty(index = 2)
+    private BigDecimal consumption;
+    /**
+     * 抄表日期
+     */
+    @ExcelProperty(index = 3)
+    private Date readingDate;
+}

+ 37 - 0
zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/BillGenerationController.java

@@ -0,0 +1,37 @@
+package com.rongwei.zhsw.system.controller;
+
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.zhsw.system.service.impl.BillGenerationServiceImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * BillGenerationController class
+ *
+ * @author XH
+ * @date 2025/03/18
+ */
+@RestController
+@RequestMapping("/bill")
+public class BillGenerationController {
+    private static final Logger log = LoggerFactory.getLogger(BillGenerationController.class);
+
+    @Autowired
+    private BillGenerationServiceImpl billGenerationService;
+
+    @PostMapping("/generate/{id}")
+    private R generateBill(@PathVariable("id") String id) {
+        billGenerationService.generateBill(id);
+        return R.ok();
+    }
+    @PostMapping("/generate")
+    private R generateBill() {
+        billGenerationService.generateBill();
+        return R.ok();
+    }
+}

+ 30 - 0
zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/ImportExcelController.java

@@ -0,0 +1,30 @@
+package com.rongwei.zhsw.system.controller;
+
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.zhsw.system.service.impl.ImportExcelServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * ImportExcelController class
+ *
+ * @author XH
+ * @date 2025/03/19
+ */
+
+@RestController
+@RequestMapping("/import")
+public class ImportExcelController {
+
+    @Autowired
+    private ImportExcelServiceImpl importExcelService;
+
+
+    @PostMapping("/meter-reading/{fileId}")
+    private R meterReadingRecord(@PathVariable("fileId") String fileId) {
+        return importExcelService.meterReadingRecord(fileId);
+    }
+}

+ 2 - 2
zhsw-server/src/main/resources/bootstrap-dev.yml

@@ -4,9 +4,9 @@ spring:
       config:
         file-extension: yaml
         server-addr: 127.0.0.1:8848
-        namespace: 9caed6dc-3784-4d73-bd4c-a8e8153bc358
+        namespace: cd047569-9470-4dfb-8663-b113d01cd30f
         ext-config[0]:
           data-id: common-config.yaml
       discovery:
         server-addr: 127.0.0.1:8848
-        namespace: 9caed6dc-3784-4d73-bd4c-a8e8153bc358
+        namespace: cd047569-9470-4dfb-8663-b113d01cd30f