Browse Source

发票参数配置

609324174@qq.com 4 years ago
parent
commit
49feec2b8a

+ 48 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayInvoiceParamController.java

@@ -0,0 +1,48 @@
+package com.bz.smart_city.controller.pay;
+
+import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.dto.pay.PayBaseAccountWaterusedamountDto;
+import com.bz.smart_city.entity.pay.PayBaseAccount;
+import com.bz.smart_city.entity.pay.PayInvoiceParam;
+import com.bz.smart_city.service.pay.PayInvoiceParamService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @ClassName PayInvoiceParamController
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/27
+ * @Version V1.0
+ **/
+@RestController
+@RequestMapping("invoiceparam")
+@Api(tags = "计费系统—发票—发票参数配置")
+public class PayInvoiceParamController {
+    @Autowired
+    PayInvoiceParamService payInvoiceParamService;
+
+    @GetMapping("/findList")
+    @ApiOperation(value="查询发票参数",notes="返回所有发票参数配置项")
+    public AjaxMessage<List<PayInvoiceParam>> findInvoiceList(@ApiParam(value = "查询字段", required = false) @RequestParam(required = false) String queryparam) {
+        List<PayInvoiceParam> payInvoiceParams = payInvoiceParamService.findList(queryparam);
+        return new AjaxMessage<>(ResultStatus.OK, payInvoiceParams);
+    }
+    @PutMapping("/updateinvoiceparam")
+    @ApiOperation(value = "修改发票参数",notes = "修改发票参数")
+    public AjaxMessage edit(@ApiParam(value = "发票参数",required = true) @RequestBody(required = true) @Validated PayInvoiceParam payInvoiceParam)
+    {
+        int resultId = payInvoiceParamService.update(payInvoiceParam);
+        if(resultId == 1)
+            return new AjaxMessage(ResultStatus.OK);
+        else
+            return new AjaxMessage(ResultStatus.ERROR);
+    }
+}

+ 24 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayInvoiceParamMapper.java

@@ -0,0 +1,24 @@
+package com.bz.smart_city.dao.pay;
+
+import com.bz.smart_city.entity.pay.PayInvoiceParam;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigInteger;
+import java.util.List;
+
+/**
+ * @ClassName PayInvoiceParamMapper
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/27
+ * @Version V1.0
+ **/
+@Mapper
+public interface PayInvoiceParamMapper {
+    int batchInsert(@Param("list") List<PayInvoiceParam> list);
+
+    int update(@Param("payInvoiceParam") PayInvoiceParam payInvoiceParam);
+
+    List<PayInvoiceParam> findList(@Param("queryparam") String queryparam,@Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
+}

+ 49 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayBaseInfo.java

@@ -0,0 +1,49 @@
+package com.bz.smart_city.entity.pay;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+
+/**
+ * @ClassName PayBaseInfo
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/27
+ * @Version V1.0
+ **/
+@Data
+@ApiModel(value = "公用属性")
+public abstract class PayBaseInfo {
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间",  hidden = true)
+    private LocalDateTime createDate;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间",  hidden = true)
+    private LocalDateTime updateDate;
+
+    @ApiModelProperty(value = "备注",  hidden = true)
+    private String remarks;
+
+    @ApiModelProperty(value = "删除标志",  hidden = true)
+    @JsonIgnore
+    private String delFlag;
+
+    @ApiModelProperty(value = "修改者id",  hidden = true)
+    private BigInteger updateBy;
+
+    @ApiModelProperty(value = "创建者id",  hidden = true)
+    private BigInteger createBy;
+
+    @ApiModelProperty(value = "站点id",  hidden = true)
+    private BigInteger siteId;
+
+    @ApiModelProperty(value = "客户id",  hidden = true)
+    private BigInteger customerId;
+
+}

+ 52 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayInvoiceParam.java

@@ -0,0 +1,52 @@
+package com.bz.smart_city.entity.pay;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.naming.Name;
+import java.math.BigInteger;
+
+/**
+ * @ClassName PayInvoiceParam
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/27
+ * @Version V1.0
+ **/
+@Data
+@ApiModel(value = "发票参数")
+public class PayInvoiceParam extends  PayBaseInfo {
+    @ApiModelProperty(value = "主键id")
+    private BigInteger id;
+    @ApiModelProperty(value = "费用类型")
+    private Integer feetype;
+    @ApiModelProperty(value = "费用类型名称")
+    private String feetypename;
+    @ApiModelProperty(value = "零税率标识")
+    private String zerotax;
+    @ApiModelProperty(value = "税收分类编码")
+    private String goodstaxno;
+    @ApiModelProperty(value = "税率")
+    private String taxrate;
+    @ApiModelProperty(value = "增值税特殊管理")
+    private String othermanger;
+    @ApiModelProperty(value = "单价含税标识")
+    private String pricetax;
+    @ApiModelProperty(value = "发票行性质")
+    private String nature;
+    @ApiModelProperty(value = "优惠政策标识")
+    private String prepolicy;
+    @ApiModelProperty(value = "规格型号")
+    private String spec;
+    @ApiModelProperty(value = "单位")
+    private String unit;
+    @ApiModelProperty(value = "自行编码")
+    private String zsbm;
+    @ApiModelProperty(value = "扣除额")
+    private String kec;
+    @JsonIgnore
+    @ApiModelProperty(value = "查询字段(收费项目或税收分类编码)")
+    private String queryparam;
+}

+ 76 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayInvoiceParamServiceImpl.java

@@ -0,0 +1,76 @@
+package com.bz.smart_city.service.impl.pay;
+
+import com.bz.smart_city.commom.exception.ServiceException;
+import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.pay.PayInvoiceParamMapper;
+import com.bz.smart_city.dao.pay.PaySysDictMapper;
+import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.dto.pay.PaySysDictSelectDto;
+import com.bz.smart_city.entity.pay.PayInvoiceParam;
+import com.bz.smart_city.entity.pay.PaySysDict;
+import com.bz.smart_city.service.pay.PayInvoiceParamService;
+import com.bz.smart_city.service.pay.PaySysDictService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName PayInvoiceParamServiceImpl
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/27
+ * @Version V1.0
+ **/
+@Service
+public class PayInvoiceParamServiceImpl implements PayInvoiceParamService {
+    @Resource
+    PayInvoiceParamMapper payInvoiceParamMapper;
+    @Resource
+    PaySysDictMapper paySysDictMapper;
+    @Override
+    public int batchInsert() {
+        //1、从登陆信息中获取站点Id 水司ID
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
+        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        List<PaySysDictSelectDto> paySysDictSelectDtos = paySysDictMapper.getDicts("收费类型", siteId, customerId);
+        List<PayInvoiceParam> list = new ArrayList<PayInvoiceParam>();
+        for (PaySysDictSelectDto item: paySysDictSelectDtos) {
+            PayInvoiceParam payInvoiceParam = new PayInvoiceParam();
+            payInvoiceParam.setFeetype(Integer.valueOf(item.getValue()));
+            payInvoiceParam.setDelFlag("0");
+            payInvoiceParam.setSiteId(siteId);
+            payInvoiceParam.setCustomerId(customerId);
+            payInvoiceParam.setCreateBy(BigInteger.valueOf(loginUser.getId()));
+            payInvoiceParam.setCreateDate(LocalDateTime.now());
+            payInvoiceParam.setUpdateBy(BigInteger.valueOf(loginUser.getId()));
+            payInvoiceParam.setUpdateDate(LocalDateTime.now());
+            list.add(payInvoiceParam);
+        }
+        return payInvoiceParamMapper.batchInsert(list);
+    }
+
+    @Override
+    public int update(PayInvoiceParam payInvoiceParam) {
+        return payInvoiceParamMapper.update(payInvoiceParam);
+    }
+    @Override
+    public List<PayInvoiceParam> findList(String queryparam) {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
+        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+
+        List<PayInvoiceParam> payInvoiceParams = payInvoiceParamMapper.findList(queryparam,siteId,customerId);
+        if(payInvoiceParams.size()==0)
+        {
+            batchInsert();
+            payInvoiceParams = payInvoiceParamMapper.findList(queryparam,siteId,customerId);
+        }
+        return  payInvoiceParams;
+    }
+}

+ 22 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayInvoiceParamService.java

@@ -0,0 +1,22 @@
+package com.bz.smart_city.service.pay;
+
+import com.bz.smart_city.entity.pay.PayInvoiceParam;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigInteger;
+import java.util.List;
+
+/**
+ * @ClassName PayInvoiceParamService
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/27
+ * @Version V1.0
+ **/
+public interface PayInvoiceParamService {
+    int batchInsert();
+
+    int update(PayInvoiceParam payInvoiceParam);
+
+    List<PayInvoiceParam> findList(String queryparam);
+}

+ 144 - 0
smart-city-platform/src/main/resources/mapper/pay/PayInvoiceParamMapper.xml

@@ -0,0 +1,144 @@
+<?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.bz.smart_city.dao.pay.PayInvoiceParamMapper">
+    <update id="update">
+        update pay_invoice_param
+        <set>
+            <if test="payInvoiceParam.zerotax != null"> zerotax=#{payInvoiceParam.zerotax,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.goodstaxno != null">goodstaxno=#{payInvoiceParam.goodstaxno,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.taxrate != null">taxrate=#{payInvoiceParam.taxrate,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.pricetax != null">pricetax=#{payInvoiceParam.pricetax,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.nature != null">nature=#{payInvoiceParam.nature,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.prepolicy != null">prepolicy=#{payInvoiceParam.prepolicy,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.spec != null">spec=#{payInvoiceParam.spec,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.unit != null">unit=#{payInvoiceParam.unit,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.zsbm != null">zsbm=#{payInvoiceParam.zsbm,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.kec != null">kec=#{payInvoiceParam.kec,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.othermanger != null">othermanger=#{payInvoiceParam.othermanger,jdbcType=VARCHAR},</if>
+            <if test="payInvoiceParam.updateBy != null">update_by=#{payInvoiceParam.updateBy,jdbcType=BIGINT},</if>
+            <if test="payInvoiceParam.updateDate != null">update_date=#{payInvoiceParam.updateDate,jdbcType=TIMESTAMP},</if>
+            <if test="payInvoiceParam.remarks != null">remarks=#{payInvoiceParam.remarks,jdbcType=VARCHAR},</if>
+        </set>
+        where id=#{payInvoiceParam.id,jdbcType=BIGINT}
+    </update>
+
+    <select id="findList" resultType="com.bz.smart_city.entity.pay.PayInvoiceParam">
+        select
+        param.id,
+        param.feetype,
+        param.zerotax,
+        param.goodstaxno,
+        param.taxrate,
+        param.pricetax,
+        param.nature,
+        param.prepolicy,
+        param.spec,
+        param.unit,
+        param.zsbm,
+        param.kec,
+        param.othermanger,
+        dict.label as feetypename
+        from pay_invoice_param param
+        inner join pay_sys_dict dict on dict.type='收费类型' and dict.site_id=#{siteId} and dict.customer_id=#{customerId} and dict.value=param.feetype
+        where param.del_flag='0' and param.site_id=#{siteId} and param.customer_id=#{customerId}
+        <if test="queryparam != null">
+           and  (dict.label = #{queryparam} or param.goodstaxno = #{queryparam})
+        </if>
+
+        order by param.feetype
+    </select>
+
+    <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
+        insert into pay_invoice_param(
+        feetype,
+        zerotax,
+        goodstaxno,
+        taxrate,
+        pricetax,
+        nature,
+        prepolicy,
+        spec,
+        unit,
+        zsbm,
+        kec,
+        othermanger,
+        create_by,
+        create_date,
+        update_by,
+        update_date,
+        remarks,
+        del_flag,
+        site_id,
+        customer_id)
+        values
+            (
+            #{payInvoiceParam.feetype},
+            #{payInvoiceParam.zerotax},
+            #{payInvoiceParam.goodstaxno},
+            #{payInvoiceParam.taxrate},
+            #{payInvoiceParam.pricetax},
+            #{payInvoiceParam.nature},
+            #{payInvoiceParam.prepolicy},
+            #{payInvoiceParam.spec},
+            #{payInvoiceParam.unit},
+            #{payInvoiceParam.zsbm},
+            #{payInvoiceParam.kec},
+            #{payInvoiceParam.othermanger},
+            #{payInvoiceParam.createBy},
+            #{payInvoiceParam.createDate,jdbcType=TIMESTAMP},
+            #{payInvoiceParam.updateBy},
+            #{payInvoiceParam.updateDate,jdbcType=TIMESTAMP},
+            #{payInvoiceParam.remarks},
+            #{payInvoiceParam.delFlag},
+            #{payInvoiceParam.siteId},
+            #{payInvoiceParam.customerId}
+            )
+    </insert>
+    <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
+        insert into pay_invoice_param(
+        feetype,
+        zerotax,
+        goodstaxno,
+        taxrate,
+        pricetax,
+        nature,
+        prepolicy,
+        spec,
+        unit,
+        zsbm,
+        kec,
+        othermanger,
+        create_by,
+        create_date,
+        update_by,
+        update_date,
+        remarks,
+        del_flag,
+        site_id,
+        customer_id)
+        values
+        <foreach collection="list" item="payInvoiceParam" separator=",">
+            (
+        #{payInvoiceParam.feetype},
+        #{payInvoiceParam.zerotax},
+        #{payInvoiceParam.goodstaxno},
+        #{payInvoiceParam.taxrate},
+        #{payInvoiceParam.pricetax},
+        #{payInvoiceParam.nature},
+        #{payInvoiceParam.prepolicy},
+        #{payInvoiceParam.spec},
+        #{payInvoiceParam.unit},
+        #{payInvoiceParam.zsbm},
+        #{payInvoiceParam.kec},
+        #{payInvoiceParam.othermanger},
+        #{payInvoiceParam.createBy},
+        #{payInvoiceParam.createDate,jdbcType=TIMESTAMP},
+        #{payInvoiceParam.updateBy},
+        #{payInvoiceParam.updateDate,jdbcType=TIMESTAMP},
+        #{payInvoiceParam.remarks},
+        #{payInvoiceParam.delFlag},
+        #{payInvoiceParam.siteId},
+        #{payInvoiceParam.customerId})
+        </foreach>
+    </insert>
+</mapper>