Jelajahi Sumber

应收应付

y 2 tahun lalu
induk
melakukan
098ca87cf7

+ 3 - 0
src/main/java/com/ydtech/modules/inv/controller/InvReceivableController.java

@@ -78,7 +78,10 @@ public class InvReceivableController extends BaseController {
         if (!Files.exists(path)) {
             Files.createDirectories(path);
         }
+
         String fileName = EasyExcelUtils.downExcel(uploadPath, "应收表", InvSource.class, recivablePage);
+
+
         return HttpResult.ok(uploadUrl + "excel/" + fileName);
     }
 

+ 7 - 0
src/main/java/com/ydtech/modules/inv/model/excel/InvSourceExcel.java

@@ -249,4 +249,11 @@ public class InvSourceExcel implements Serializable {
      */
     @ExcelProperty("结算状态")
     private String clearingState;
+
+    @ExcelProperty("导入日期")
+    @JsonFormat(pattern = "yyyy年MM月dd日")
+    private String revenueTime;
+
+    @ExcelProperty("导入人名字")
+    private String revenueName;
 }

+ 2 - 0
src/main/java/com/ydtech/modules/inv/model/vo/ReceivableAndSettlementQueryVo.java

@@ -46,6 +46,8 @@ public class ReceivableAndSettlementQueryVo extends PageRequest {
     private String clearingState; // 结算状态
     @ApiModelProperty(value = "保司结算状态")
     private String insuranceClearingState;
+    @ApiModelProperty(value = "应收导入时间")
+    private String revenueTime;
     @ApiModelProperty(value = "应收导入开始时间")
     private String revenueTimeStartTime; // 应收导入开始时间
     @ApiModelProperty(value = "应收导入结束时间")

+ 13 - 5
src/main/java/com/ydtech/modules/inv/service/impl/InvReceivableServiceImpl.java

@@ -389,6 +389,11 @@ public class InvReceivableServiceImpl implements InvReceivableService {
             invSourceQueryVo.setClearingTimeStartTime(split1[0]);
             invSourceQueryVo.setClearingTimeEndTime(split1[1]);
         }
+        if (invSourceQueryVo.getRevenueTime() != null && !"".equals(invSourceQueryVo.getRevenueTime())) {
+            String[] split1 = invSourceQueryVo.getRevenueTime().split(",");
+            invSourceQueryVo.setRevenueTimeStartTime(split1[0]);
+            invSourceQueryVo.setRevenueTimeEndTime(split1[1]);
+        }
 
         List<InvSource> pageData = invSourceMapper.getRecivableList(invSourceQueryVo);
         pageData.forEach(x -> {
@@ -551,17 +556,20 @@ public class InvReceivableServiceImpl implements InvReceivableService {
 
     @Override
     public Page<ReceivableAndSettlementVo> getReceivableAndSettlementPage(ReceivableAndSettlementQueryVo receivableAndSettlementQueryVo) {
+        InvSourceQueryVo invSourceQueryVo = new InvSourceQueryVo();
         Page page = new Page();
         page.setCurrent(receivableAndSettlementQueryVo.getPageNum());
         page.setSize(receivableAndSettlementQueryVo.getPageSize());
-        InvSourceQueryVo invSourceQueryVo = new InvSourceQueryVo();
-        if (invSourceQueryVo.getRevenueTime() != null && !"".equals(invSourceQueryVo.getRevenueTime())) {
-            String[] split1 = invSourceQueryVo.getRevenueTime().split(",");
-            invSourceQueryVo.setRevenueTimeStartTime(split1[0]);
-            invSourceQueryVo.setRevenueTimeEndTime(split1[1]);
+
+        if (receivableAndSettlementQueryVo.getRevenueTime() != null && !"".equals(receivableAndSettlementQueryVo.getRevenueTime())) {
+            String[] split1 = receivableAndSettlementQueryVo.getRevenueTime().split(",");
+            receivableAndSettlementQueryVo.setRevenueTimeStartTime(split1[0]);
+            receivableAndSettlementQueryVo.setRevenueTimeEndTime(split1[1]);
         }
+
         Page<ReceivableAndSettlementVo> receivableAndSettlementPage = invReceivableMapper.getReceivableAndSettlementPage(page,
                 receivableAndSettlementQueryVo);
+
         return receivableAndSettlementPage;
     }
 

+ 11 - 6
src/main/java/com/ydtech/modules/inv/service/impl/InvSourceServiceImpl.java

@@ -18,6 +18,8 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.List;
 
 /**
@@ -40,13 +42,14 @@ public class InvSourceServiceImpl extends ServiceImpl<InvSourceMapper, InvSource
 
         List<InvSourceExcel> invSourceExcels = EasyExcelUtils.readInvSourceExcel(uploadFilePath + file, InvSourceExcel.class);
         List<InvSource> invSources = JSON.parseArray(JSONArray.toJSONString(invSourceExcels), InvSource.class);
-
         SysUser user = BaseController.getUser();
-        InvSource invSource = new InvSource();
-        invSource.setRevenueName(String.valueOf(user));
 
         DateTime dateTime = new DateTime();
-        invSource.setRevenueTime(String.valueOf(dateTime));
+
+        for (InvSource invSource : invSources) {
+            invSource.setRevenueName(user.getName());
+            invSource.setRevenueTime(dateTime.toString());
+        }
 
         boolean result = invSourceService.saveOrUpdateBatchWithConditions(invSources);
         return result ? HttpResult.ok("导入成功") : HttpResult.error("导入失败");
@@ -66,12 +69,13 @@ public class InvSourceServiceImpl extends ServiceImpl<InvSourceMapper, InvSource
     @Transactional
     public boolean saveOrUpdateBatchWithConditions(List<InvSource> invSourceList) {
         for (InvSource invSource : invSourceList) {
+
+
             InvSource one = baseMapper.selectOne(new LambdaQueryWrapper<InvSource>()
                     .eq(InvSource::getLicenseno, invSource.getLicenseno())
                     .eq(InvSource::getJqPolicyId, invSource.getJqPolicyId())
                     .eq(InvSource::getSyPolicyId, invSource.getSyPolicyId())
-                    .eq(InvSource::getNonCarPolicyId, invSource.getNonCarPolicyId())
-                    .eq(InvSource::getRevenueTime,invSource.getRevenueTime()));
+                    .eq(InvSource::getNonCarPolicyId, invSource.getNonCarPolicyId()));
 
             if (one != null) {
                 invSource.setId(one.getId());
@@ -83,6 +87,7 @@ public class InvSourceServiceImpl extends ServiceImpl<InvSourceMapper, InvSource
         return true;
     }
 
+
 }
 
 

+ 2 - 0
src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.inv.utils;
 
 import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.alibaba.excel.util.ListUtils;
 import com.alibaba.excel.write.builder.ExcelWriterBuilder;
 import com.ydtech.constants.enums.inv.InvPayMethodEnum;
@@ -214,6 +215,7 @@ public class EasyExcelUtils {
         // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
 //        List<InvSourceExcel> list = new ArrayList<>();
         List<InvSourceExcel> list = EasyExcel.read(uploadFilePath, clz, new InvSourceDataListener())
+                .excelType(ExcelTypeEnum.XLSX)
                 .sheet()
                 .sheetName("来源表")
                 .doReadSync();

+ 4 - 1
src/main/resources/mapper/modules/inv/InvReceivableMapper.xml

@@ -350,7 +350,10 @@
             and a.non_car_policy_id = #{param.nonCarPolicyId}
         </if>
         <if test="param.revenueTimeStartTime != null and param.revenueTimeStartTime != ''">
-            and a.revenue_time between #{param.revenueTimeStartTime} and #{param.revenueTimeEndTime}
+            and a.revenue_time <![CDATA[ >= ]]> CAST(CONCAT(#{param.revenueTimeStartTime},' 00:00:00') AS datetime)
+        </if>
+        <if test="param.revenueTimeEndTime != null  and param.revenueTimeEndTime != '' " >
+            and a.revenue_time <![CDATA[ <= ]]> CAST(CONCAT(#{param.revenueTimeEndTime},' 23:59:59') AS datetime)
         </if>
 
     </select>

+ 13 - 1
src/main/resources/mapper/modules/inv/InvSourceMapper.xml

@@ -174,11 +174,15 @@
             and a.insured_name = #{insuredName}
         </if>
         <if test="param.revenueTimeStartTime != null and param.revenueTimeStartTime != ''">
-            and a.revenue_time between #{param.revenueTimeStartTime} and #{param.revenueTimeEndTime}
+            and a.revenue_time <![CDATA[ >= ]]> CAST(CONCAT(#{param.revenueTimeStartTime},' 00:00:00') AS datetime)
+        </if>
+        <if test="param.revenueTimeEndTime != null  and param.revenueTimeEndTime != '' " >
+            and a.revenue_time <![CDATA[ <= ]]> CAST(CONCAT(#{param.revenueTimeEndTime},' 23:59:59') AS datetime)
         </if>
         <if test="param.revenueName != null and param.revenueName != ''">
             and a.revenue_name = #{revenueName}
         </if>
+
     </select>
 
 
@@ -223,6 +227,8 @@
         max_sy_receivable_ratio,
         max_non_car_receivable_ratio,
         max_receivable,
+        revenue_time,
+        revenue_name,
         CASE WHEN DATEDIFF(NOW(), signing_time) > 90 THEN 2 ELSE inv_source.clearing_state END as clearing_state,
         insurance_clearing_state
         from inv_source
@@ -264,5 +270,11 @@
         <if test="param.insuranceClearingState != null and param.insuranceClearingState != ''">
             and a.insurance_clearing_state = #{param.insuranceClearingState}
         </if>
+        <if test="param.revenueTimeEndTime != null  and param.revenueTimeEndTime != '' " >
+            and a.revenue_time <![CDATA[ <= ]]> CAST(CONCAT(#{param.revenueTimeEndTime},' 23:59:59') AS datetime)
+        </if>
+        <if test="param.revenueName != null and param.revenueName != ''">
+            and a.revenue_name = #{revenueName}
+        </if>
     </select>
 </mapper>