瀏覽代碼

结算单模块优化

guoweisong 2 年之前
父節點
當前提交
54c9596d71

+ 14 - 1
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.time.Period;
 
 /**
  * <p>
@@ -43,7 +44,19 @@ public class InsPlyIncomeController extends BaseController {
     @ApiOperation(value = "[1]保司费用查询")
     public HttpResult<BasePageResult<InsPlyIncome>> queryPage(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
 
-
+        if(StringUtils.isNullOrEmpty(insPlyIncomeVo.getCompanyId())
+                && StringUtils.isNullOrEmpty(insPlyIncomeVo.getStartDate())
+                && StringUtils.isNullOrEmpty(insPlyIncomeVo.getEndDate())
+                && StringUtils.isNullOrEmpty(insPlyIncomeVo.getLicenseno())
+        ){
+            return HttpResult.error("查询条件不能全为空!");
+        }
+        if(!StringUtils.isNullOrEmpty(insPlyIncomeVo.getStartDate())
+                &&!StringUtils.isNullOrEmpty(insPlyIncomeVo.getEndDate())
+                &&Period.between(insPlyIncomeVo.getStartDate(),insPlyIncomeVo.getEndDate()).getDays()>100
+        ){
+            return HttpResult.error("查询时间区间不能超过3个月!");
+        }
         if(StringUtils.isNullOrEmpty(insPlyIncomeVo.getDeptId())){
             insPlyIncomeVo.setDeptId(getDeptId());
         }

+ 17 - 3
src/main/java/com/ydtech/modules/fnc/controller/InsPlySettleController.java

@@ -7,6 +7,7 @@ import com.ydtech.modules.fnc.entity.InsPlySettle;
 import com.ydtech.modules.fnc.entity.InsPlySettleHx;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.ydtech.modules.fnc.service.InsPlySettleService;
+import com.ydtech.modules.fnc.vo.GenerateSettleVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.InsPlySettleVo;
 import com.ydtech.modules.order.entity.BasePageResult;
@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.time.Period;
 import java.util.List;
 
 /**
@@ -51,8 +53,20 @@ public class InsPlySettleController extends BaseController {
             return HttpResult.error("保险公司必传");
         }
         if(StringUtils.isNullOrEmpty(insPlyIncomeVo.getDeptId())){
-            insPlyIncomeVo.setDeptId(getDeptId());
+            return HttpResult.error("机构不能为空");
         }
+        if(StringUtils.isNullOrEmpty(insPlyIncomeVo.getStartDate())
+                && StringUtils.isNullOrEmpty(insPlyIncomeVo.getEndDate())
+            ){
+            return HttpResult.error("出单区间不能为空!");
+        }
+        if(!StringUtils.isNullOrEmpty(insPlyIncomeVo.getStartDate())
+                &&!StringUtils.isNullOrEmpty(insPlyIncomeVo.getEndDate())
+                && Period.between(insPlyIncomeVo.getStartDate(),insPlyIncomeVo.getEndDate()).getDays()>100
+        ){
+            return HttpResult.error("查询时间区间不能超过3个月!");
+        }
+
         insPlyIncomeVo.setFlag("0");
         HttpResult<BasePageResult<InsPlyIncome>> result=insPlyIncomeService.queryplyIncome(insPlyIncomeVo);
 
@@ -64,12 +78,12 @@ public class InsPlySettleController extends BaseController {
      */
     @ApiOperation(value = "[2]结算单生成页面--结算单生成")
     @PostMapping("/generateSettle")
-    public HttpResult generateSettleAndDetail(@RequestBody List<String> plyNoList){
+    public HttpResult generateSettleAndDetail(@RequestBody GenerateSettleVo generateSettleVo){
 
         HttpResult result = null;
         try {
 
-            result = insPlySettleService.generateSettleAndDetail(plyNoList);
+            result = insPlySettleService.generateSettleAndDetail(generateSettleVo);
         } catch (Exception e) {
             result = HttpResult.error("结算单生成失败!"+e.getMessage());
             e.printStackTrace();

+ 4 - 1
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -26,8 +26,11 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
             "from ins_ply_income a " +
             "left join sys_dept b on a.dept_id=b.id " +
             "left join esm_ins_company c on a.company_id=c.id " +
-            "where DATE_FORMAT(pay_date, '%Y-%m-%d') " +
+            "where 1=1 " +
+            "<if test='startDate!=null and endDate!=null'>" +
+            "and DATE_FORMAT(pay_date, '%Y-%m-%d') " +
             "between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')" +
+            "</if> "+
             "<if test='companyId!=\"\" and companyId!=null '>" +
             "   and a.company_id=#{companyId} " +
             "</if> "+

+ 2 - 1
src/main/java/com/ydtech/modules/fnc/service/InsPlySettleService.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.fnc.entity.InsPlySettle;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.fnc.entity.InsPlySettleDetail;
 import com.ydtech.modules.fnc.entity.InsPlySettleHx;
+import com.ydtech.modules.fnc.vo.GenerateSettleVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.InsPlySettleVo;
 import com.ydtech.modules.order.entity.BasePageResult;
@@ -22,7 +23,7 @@ import java.util.List;
  */
 public interface InsPlySettleService extends IService<InsPlySettle> {
 
-    public HttpResult generateSettleAndDetail(List<String> plyNoList);
+    public HttpResult generateSettleAndDetail(GenerateSettleVo generateSettleVo);
 
     public HttpResult<BasePageResult<InsPlySettle>> selectSettle(InsPlySettleVo insPlySettle);
 

+ 16 - 6
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlySettleServiceImpl.java

@@ -16,6 +16,7 @@ import com.ydtech.modules.fnc.entity.InsPlySettleDetail;
 import com.ydtech.modules.fnc.entity.InsPlySettleHx;
 import com.ydtech.modules.fnc.service.InsPlySettleService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.fnc.vo.GenerateSettleVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.InsPlySettleVo;
 import com.ydtech.modules.order.entity.BasePageResult;
@@ -53,8 +54,17 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
     private InsPlySettleHxMapper insPlySettleHxMapper;
     @Override
     @Transactional
-    public HttpResult generateSettleAndDetail(List<String> plyNoList) {
+    public HttpResult generateSettleAndDetail(GenerateSettleVo generateSettleVo) {
 
+        List<String> plyNoList= generateSettleVo.getPlyNoList();
+        String companyId=generateSettleVo.getCompanyId();
+        String deptId =generateSettleVo.getDeptId();
+        String settleMonth=generateSettleVo.getSettleMonth();
+        if(StringUtils.isNullOrEmpty(companyId)
+                ||StringUtils.isNullOrEmpty(deptId)
+                ||StringUtils.isNullOrEmpty(settleMonth)){
+            return HttpResult.error("保险公司、机构、结算月份不能为空");
+        }
         String settleno = "";
         BigDecimal commissionFeevalue=new BigDecimal(0);
         BigDecimal otherFeevalue=new BigDecimal(0);
@@ -63,8 +73,8 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
             return HttpResult.error("结算清单不能传空");
         }
         // 生成结算单号
-        InsPlyIncome insPlyIncome_t=insPlyIncomeMapper.selectByPlyno(plyNoList.get(0));
-        settleno = insPlyIncome_t.getCompanyId()+ DateUtil.yyyyMMddHHmmss(new Date());
+//        InsPlyIncome insPlyIncome_t=insPlyIncomeMapper.selectByPlyno(plyNoList.get(0));
+        settleno = companyId+ DateUtil.yyyyMMddHHmmss(new Date());
         for(String plyNo:plyNoList){
             InsPlyIncome insPlyIncome=insPlyIncomeMapper.selectByPlyno(plyNo);
             InsPlySettleDetail insPlySettleDetail =new InsPlySettleDetail();
@@ -89,9 +99,9 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
         }
         InsPlySettle insPlySettle =new InsPlySettle();
         insPlySettle.setSettleno(settleno);
-        insPlySettle.setCompanyId(insPlyIncome_t.getCompanyId());
-        insPlySettle.setDeptId(insPlyIncome_t.getDeptId());
-        insPlySettle.setSettleMonth(YearMonth.from(insPlyIncome_t.getPayDate()).toString());
+        insPlySettle.setCompanyId(companyId);
+        insPlySettle.setDeptId(deptId);
+        insPlySettle.setSettleMonth(settleMonth);
         String settleBatch =this.baseMapper.getMaxBatch(insPlySettle);
         if(StringUtils.isNullOrEmpty(settleBatch)){
             settleBatch="1";

+ 29 - 0
src/main/java/com/ydtech/modules/fnc/vo/GenerateSettleVo.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.fnc.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author gws
+ * @description:TODO
+ * @date 2024-01-16 17:58
+ */
+@Data
+@ApiModel("生成结算单Vo")
+public class GenerateSettleVo {
+    @ApiModelProperty("机构")
+    private String deptId;
+
+    @ApiModelProperty("保险公司")
+    private String companyId;
+
+    @ApiModelProperty("结算月份")
+    private String settleMonth;
+
+    @ApiModelProperty("保单号数组")
+    private List<String> plyNoList;
+}