Bläddra i källkod

新增菜单 合同优惠金额开发

ly 1 år sedan
förälder
incheckning
f8441a45cf

+ 113 - 0
src/main/java/cn/ezhizao/project/business/lable/controller/BizLableController.java

@@ -0,0 +1,113 @@
+package cn.ezhizao.project.business.lable.controller;
+
+import java.util.List;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.project.business.lable.domain.BizLable;
+import cn.ezhizao.project.business.lable.service.IBizLableService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
+
+import cn.ezhizao.framework.web.controller.BaseController;
+import cn.ezhizao.framework.web.domain.AjaxResult;
+import cn.ezhizao.framework.web.page.TableDataInfo;
+
+/**
+ * 客户标签Controller
+ *
+ * @author ruoyi
+ * @date 2024-06-12
+ */
+@RestController
+@RequestMapping("/business/lable")
+public class BizLableController extends BaseController {
+    @Resource
+    private IBizLableService bizLableService;
+
+    /**
+     * 查询客户标签列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:lable:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(BizLable bizLable) throws NoSuchFieldException, IllegalAccessException {
+        setTenantId(bizLable);
+        startPage();
+        List<BizLable> list = bizLableService.getList(bizLable);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/getList")
+    public AjaxResult getList( ) throws NoSuchFieldException, IllegalAccessException {
+        Long tenantId = getTenantId();
+        BizLable bizLable = new BizLable();
+        bizLable.setTenantId(tenantId);
+        setTenantId(bizLable);
+        List<BizLable> list = bizLableService.getList(bizLable);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 导出客户标签列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:lable:export')")
+    @Log(title = "客户标签", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BizLable bizLable) throws NoSuchFieldException, IllegalAccessException {
+        setTenantId(bizLable);
+        List<BizLable> list = bizLableService.getList(bizLable);
+        ExcelUtil<BizLable> util = new ExcelUtil<BizLable>(BizLable.class);
+        util.exportExcel(response, list, "客户标签数据");
+    }
+
+    /**
+     * 获取客户标签详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:lable:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(bizLableService.getById(id));
+    }
+
+    /**
+     * 新增客户标签
+     */
+    @PreAuthorize("@ss.hasPermi('business:lable:add')")
+    @Log(title = "客户标签", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BizLable bizLable) throws NoSuchFieldException, IllegalAccessException {
+        setTenantId(bizLable);
+        return toAjax(bizLableService.save(bizLable));
+    }
+
+    /**
+     * 修改客户标签
+     */
+    @PreAuthorize("@ss.hasPermi('business:lable:edit')")
+    @Log(title = "客户标签", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BizLable bizLable) throws NoSuchFieldException, IllegalAccessException {
+        setTenantId(bizLable);
+        return toAjax(bizLableService.updateById(bizLable));
+    }
+
+    /**
+     * 删除客户标签
+     */
+    @PreAuthorize("@ss.hasPermi('business:lable:remove')")
+    @Log(title = "客户标签", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids) {
+        return toAjax(bizLableService.removeBatchByIds(ids));
+    }
+}

+ 30 - 0
src/main/java/cn/ezhizao/project/business/lable/domain/BizLable.java

@@ -0,0 +1,30 @@
+package cn.ezhizao.project.business.lable.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import lombok.Data;
+import io.swagger.annotations.ApiModelProperty;
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+
+/**
+ * 客户标签对象 biz_lable
+ *
+ * @author ruoyi
+ * @date 2024-06-12
+ */
+@Data
+@TableName(value = "biz_lable")
+public class BizLable extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 客户标签 */
+    @Excel(name = "客户标签")
+    @ApiModelProperty(value = "客户标签")
+    private String lable;
+
+    /** 主程序账套外键 */
+    @ApiModelProperty(value = "客户标签")
+    private Long tenantId;
+
+}

+ 30 - 0
src/main/java/cn/ezhizao/project/business/lable/mapper/BizLableMapper.java

@@ -0,0 +1,30 @@
+package cn.ezhizao.project.business.lable.mapper;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.lable.domain.BizLable;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 客户标签Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-06-12
+ */
+public interface BizLableMapper extends BaseMapper<BizLable>
+{
+    /**
+     * 查询客户标签列表
+     *
+     * @param bizLable 客户标签
+     * @return 客户标签集合
+     */
+    public List<BizLable> getList(BizLable bizLable);
+
+    /**
+     * 物理删除
+     * @param bizLable
+     * @return 删除结果
+    */
+    public int physicalDelete(BizLable bizLable);
+}

+ 31 - 0
src/main/java/cn/ezhizao/project/business/lable/service/IBizLableService.java

@@ -0,0 +1,31 @@
+package cn.ezhizao.project.business.lable.service;
+
+import cn.ezhizao.project.business.lable.domain.BizLable;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 客户标签Service接口
+ *
+ * @author ruoyi
+ * @date 2024-06-12
+ */
+public interface IBizLableService extends IService<BizLable>
+{
+    /**
+     * 查询客户标签列表
+     *
+     * @param bizLable 客户标签
+     * @return 客户标签集合
+     */
+    public List<BizLable> getList(BizLable bizLable);
+
+    /**
+     * 物理删除
+     * @param bizLable
+     * @return 删除结果
+     */
+    public int physicalDelete(BizLable bizLable);
+
+}

+ 46 - 0
src/main/java/cn/ezhizao/project/business/lable/service/impl/BizLableServiceImpl.java

@@ -0,0 +1,46 @@
+package cn.ezhizao.project.business.lable.service.impl;
+
+import javax.annotation.Resource;
+
+import cn.ezhizao.project.business.lable.domain.BizLable;
+import cn.ezhizao.project.business.lable.mapper.BizLableMapper;
+import cn.ezhizao.project.business.lable.service.IBizLableService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * 客户标签Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-06-12
+ */
+@Service
+public class BizLableServiceImpl  extends ServiceImpl<BizLableMapper, BizLable> implements IBizLableService
+{
+    @Resource
+    private BizLableMapper bizLableMapper;
+
+    /**
+     * 查询客户标签列表
+     *
+     * @param bizLable 客户标签
+     * @return 客户标签
+     */
+    @Override
+    public List<BizLable> getList(BizLable bizLable)
+    {
+        return bizLableMapper.getList(bizLable);
+    }
+
+    /**
+     * 物理删除
+     * @param bizLable
+     * @return 删除结果
+     */
+    @Override
+    public int physicalDelete(BizLable bizLable){ return bizLableMapper.physicalDelete(bizLable); };
+
+}

+ 3 - 0
src/main/java/cn/ezhizao/project/business/order/domain/BizArchiveInput.java

@@ -241,4 +241,7 @@ public class BizArchiveInput extends BaseEntity {
     private Integer isQualified;
     @TableField(exist = false)
     private Integer isOther;
+
+    @ApiModelProperty("客户标签")
+    private Long customerLabelId;
 }

+ 3 - 0
src/main/java/cn/ezhizao/project/business/order/domain/BizArchiveInputDetail.java

@@ -127,4 +127,7 @@ public class BizArchiveInputDetail extends BaseEntity
 
     @ApiModelProperty("变更类型")
     private String alterType;
+
+    @ApiModelProperty("优惠金额")
+    private BigDecimal discountAmount;
 }

+ 13 - 5
src/main/java/cn/ezhizao/project/business/order/domain/OrderExcelImportLoopModel.java

@@ -56,9 +56,11 @@ public class OrderExcelImportLoopModel {
     // 记账赠送月数
     @Excel(name = "记账赠送月数")
     private Integer keepAccountFreeMonth;
+    @Excel(name = "记账赠送金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
+    private BigDecimal keepAccountFreeAmount;
     @Excel(name = "记账开始月")
     private Date keepAccountStartMonth;
-    @Excel(name ="记账结束月")
+    @Excel(name = "记账结束月")
     private Date keepAccountEndMonth;
     // 记账总金额
     @Excel(name = "记账总金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
@@ -75,9 +77,11 @@ public class OrderExcelImportLoopModel {
     // 社保赠送月数
     @Excel(name = "社保赠送月数")
     private Integer socialSecurityFreeMonth;
+    @Excel(name = "社保赠送金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
+    private BigDecimal socialSecurityFreeAmount;
     @Excel(name = "社保开始月")
     private Date socialSecurityStartMonth;
-    @Excel(name ="社保结束月")
+    @Excel(name = "社保结束月")
     private Date socialSecurityEndMonth;
     // 社保总金额
     @Excel(name = "社保总金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
@@ -94,9 +98,11 @@ public class OrderExcelImportLoopModel {
     // 公积金赠送月数
     @Excel(name = "公积金赠送月数")
     private Integer housingFundFreeMonth;
+    @Excel(name = "社保赠送金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
+    private BigDecimal housingFundFreeAmount;
     @Excel(name = "公积金开始月")
     private Date housingFundStartMonth;
-    @Excel(name ="公积金结束月")
+    @Excel(name = "公积金结束月")
     private Date housingFundEndMonth;
     // 公积金总金额
     @Excel(name = "公积金总金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
@@ -113,12 +119,14 @@ public class OrderExcelImportLoopModel {
     // 返税赠送月数
     @Excel(name = "返税赠送月数")
     private Integer returnTaxFreeMonth;
+    @Excel(name = "返税赠送金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
+    private BigDecimal returnTaxFreeAmount;
     @Excel(name = "返税开始月")
     private Date returnTaxStartMonth;
-    @Excel(name ="返税结束月")
+    @Excel(name = "返税结束月")
     private Date returnTaxEndMonth;
     // 返税总金额
-    @Excel(name= "返税总金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
+    @Excel(name = "返税总金额", scale = 2, roundingMode = BigDecimal.ROUND_HALF_UP)
     private BigDecimal returnTaxAmount;
 
 }

+ 24 - 8
src/main/java/cn/ezhizao/project/business/order/service/impl/BizArchiveInputServiceImpl.java

@@ -713,12 +713,23 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
             BigDecimal security = item.getSocialSecurityAmount() == null ? BigDecimal.ZERO : item.getSocialSecurityAmount();
             BigDecimal housingFund = item.getHousingFundAmount() == null ? BigDecimal.ZERO : item.getHousingFundAmount();
             BigDecimal returnTax = item.getReturnTaxAmount() == null ? BigDecimal.ZERO : item.getReturnTaxAmount();
-            if (item.getAmount().compareTo(keepAccount.add(security).add(housingFund).add(returnTax)) != 0) {
+            //优惠
+            BigDecimal keepFreeAccount = item.getKeepAccountFreeAmount() == null ? BigDecimal.ZERO : item.getKeepAccountFreeAmount();
+            BigDecimal securityFree = item.getSocialSecurityFreeAmount() == null ? BigDecimal.ZERO : item.getSocialSecurityFreeAmount();
+            BigDecimal housingFundFree = item.getHousingFundFreeAmount() == null ? BigDecimal.ZERO : item.getHousingFundFreeAmount();
+            BigDecimal returnTaxFree = item.getReturnTaxFreeAmount() == null ? BigDecimal.ZERO : item.getReturnTaxFreeAmount();
+//            if (item.getAmount().compareTo(keepAccount.add(security).add(housingFund).add(returnTax)) != 0) {
+            //update 6/12 实收金额 和各项金额比较 ,各项金额填写时应该为 单价*月-优惠金额
+            if (item.getTrueAmount().compareTo(keepAccount.add(security).add(housingFund).add(returnTax)) != 0) {
                 failureNum++;
-                failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 总金额不等于实际任务金额的和。");
+                failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 实收金额不等于实际任务金额的和。");
+                continue;
+            }
+            if (item.getDiscountAmount().compareTo(keepFreeAccount.add(securityFree).add(housingFundFree).add(returnTaxFree)) != 0) {
+                failureNum++;
+                failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append("优惠金额不等于任务优惠金额的和。");
                 continue;
             }
-
             BigDecimal keepAccountPrice = item.getKeepAccountPrice() == null ? BigDecimal.ZERO : item.getKeepAccountPrice();
             BigDecimal securityPrice = item.getSocialSecurityPrice() == null ? BigDecimal.ZERO : item.getSocialSecurityPrice();
             BigDecimal housingFundPrice = item.getHousingFundPrice() == null ? BigDecimal.ZERO : item.getHousingFundPrice();
@@ -737,23 +748,23 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
                 failureMsg.append("<br/>").append(failureNum).append("合同编号 ").append(item.getContractNo()).append("已存在不能重复导入");
                 continue;
             }
-
-            if (keepAccount.compareTo(keepAccountPrice.multiply(keepAccountMonth)) != 0) {
+            //update 6/12 加单条优惠才为当月总金额
+            if (keepAccount.add(keepFreeAccount).compareTo(keepAccountPrice.multiply(keepAccountMonth)) != 0) {
                 failureNum++;
                 failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 记账总金额计算值与记账单价不符。");
                 continue;
             }
-            if (security.compareTo(securityPrice.multiply(securityMonth)) != 0) {
+            if (security.add(securityFree).compareTo(securityPrice.multiply(securityMonth)) != 0) {
                 failureNum++;
                 failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 社保总金额计算值与社保单价不符。");
                 continue;
             }
-            if (housingFund.compareTo(housingFundPrice.multiply(housingFundMonth)) != 0) {
+            if (housingFund.add(housingFundFree).compareTo(housingFundPrice.multiply(housingFundMonth)) != 0) {
                 failureNum++;
                 failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 公积金总金额计算值与公积金单价不符。");
                 continue;
             }
-            if (returnTax.compareTo(returnTaxMonth.multiply(returnTaxPrice)) != 0) {
+            if (returnTax.add(returnTaxFree).compareTo(returnTaxMonth.multiply(returnTaxPrice)) != 0) {
                 failureNum++;
                 failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 返税总金额计算值与返税单价不符。");
                 continue;
@@ -798,6 +809,8 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
                 BizArchiveInputDetail detail = new BizArchiveInputDetail();
                 detail.setTaskTypeId(1L);
                 detail.setAmount(item.getKeepAccountAmount());
+                //update 6/12
+                detail.setDiscountAmount(item.getKeepAccountFreeAmount());
                 detail.setPrice(item.getKeepAccountPrice());
                 detail.setServiceNum(item.getKeepAccountMonth());
                 detail.setFreeNum(item.getKeepAccountFreeMonth());
@@ -844,6 +857,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
                 BizArchiveInputDetail detail = new BizArchiveInputDetail();
                 detail.setTaskTypeId(2L);
                 detail.setAmount(item.getSocialSecurityAmount());
+                detail.setDiscountAmount(item.getSocialSecurityFreeAmount());
                 detail.setPrice(item.getSocialSecurityPrice());
                 detail.setServiceNum(item.getSocialSecurityMonth());
                 detail.setFreeNum(item.getSocialSecurityFreeMonth());
@@ -891,6 +905,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
                 detail.setTaskTypeId(3L);
                 detail.setAmount(item.getHousingFundAmount());
                 detail.setPrice(item.getHousingFundPrice());
+                detail.setDiscountAmount(item.getHousingFundFreeAmount());
                 detail.setServiceNum(item.getHousingFundMonth());
                 detail.setFreeNum(item.getHousingFundFreeMonth());
                 detail.setContractId(archiveInput.getId());
@@ -937,6 +952,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
                 BizArchiveInputDetail detail = new BizArchiveInputDetail();
                 detail.setTaskTypeId(4L);
                 detail.setAmount(item.getReturnTaxAmount());
+                detail.setDiscountAmount(item.getReturnTaxFreeAmount());
                 detail.setPrice(item.getReturnTaxPrice());
                 detail.setServiceNum(item.getReturnTaxMonth());
                 detail.setFreeNum(item.getReturnTaxFreeMonth());

BIN
src/main/resources/importTemplate/LoopOrderExcelTemplate.xlsx


+ 29 - 0
src/main/resources/mybatis/business/BizLableMapper.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="cn.ezhizao.project.business.lable.mapper.BizLableMapper">
+
+    <resultMap type="cn.ezhizao.project.business.lable.domain.BizLable" id="BizLableResult">
+        <id column="id" property="id"/>
+    </resultMap>
+
+
+    <select id="getList" parameterType="BizLable" resultMap="BizLableResult">
+        SELECT * FROM biz_lable
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            deleted = 0
+            <if test="lable != null  and lable != ''"> AND lable = #{lable}</if>
+        </trim>
+    </select>
+
+    <delete id="physicalDelete">
+        DELETE FROM biz_lable
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            <if test="id != null">
+                id = #{id} AND
+            </if>
+       <!-- 删除条件为其他外键可以在这里加 -->
+        </trim>
+    </delete>
+</mapper>