Commit 042cd241 authored by Administrator's avatar Administrator

赛包邮寄、发票模块接口·

parent 89b6343c
package com.dlbridge.jadp.plugins.partner.bean;
import com.dlbridge.jadp.common.persistence.JaapRecord;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@ApiModel(value = "赛包存取实体类", description = "赛包存取实体类")
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class BagDelivery extends JaapRecord<BagDelivery> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "赛事ID", notes = "赛事ID")
private Integer cmptId;
@ApiModelProperty(value = "姓名", notes = "姓名")
private String name;
@ApiModelProperty(value = "参赛号", notes = "参赛号")
private String markNo;
@ApiModelProperty(value = "手机号", notes = "手机号")
private String phone;
@ApiModelProperty(value = "地区(大陆、港澳台、国外)", notes = "地区(大陆、港澳台、国外)")
private String area;
@ApiModelProperty(value = "省", notes = "省")
private String province;
@ApiModelProperty(value = "市", notes = "市")
private String city;
@ApiModelProperty(value = "详细地址", notes = "详细地址")
private String location;
@ApiModelProperty(value = "快递号", notes = "快递号")
private String deliveryNo;
@ApiModelProperty(value = "快递公司名", notes = "快递公司名")
private String expressCompany;
@ApiModelProperty(value = "状态(1:提交,2:已处理)", notes = "状态(1:提交,2:已处理)")
private Integer status;
@ApiModelProperty(value = "备注", notes = "备注")
private String remark;
}
package com.dlbridge.jadp.plugins.partner.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@ApiModel(value = "赛包查询参数", description = "赛包查询参数")
@Getter
@Setter
public class BagParam {
@ApiModelProperty(value = "赛事ID", notes = "赛事ID")
private Integer cmptId;
@ApiModelProperty(value = "状态(1:提交,2:已处理)", notes = "状态(1:提交,2:已处理)")
private Integer status;
}
package com.dlbridge.jadp.plugins.partner.bean;
import com.dlbridge.jadp.common.persistence.JaapRecord;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
@ApiModel(value = "发票实体类", description = "发票实体类")
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class Invoice extends JaapRecord<BagDelivery> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "赛事ID", notes = "赛事ID")
private Integer cmptId;
@ApiModelProperty(value = "参赛号", notes = "参赛号")
private String markNo;
@ApiModelProperty(value = "发票类型(1:普通发票,2:增值税专票)", notes = "发票类型(1:普通发票,2:增值税专票)")
private String invoiceType;
@ApiModelProperty(value = "开票方式(0:电子发票,1:纸质发票)", notes = "开票方式(0:电子发票,1:纸质发票)")
private String paperInvoice;
@ApiModelProperty(value = "开票金额", notes = "开票金额")
private BigDecimal amount;
@ApiModelProperty(value = "开票抬头", notes = "开票抬头")
private String header;
@ApiModelProperty(value = "纳税人识别号", notes = "纳税人识别号")
private String taxPayerId;
@ApiModelProperty(value = "开户行", notes = "开户行")
private String taxBank;
@ApiModelProperty(value = "开户行账号", notes = "开户行账号")
private String taxBankAccount;
@ApiModelProperty(value = "注册地址", notes = "注册地址")
private String taxRegisteredAddress;
@ApiModelProperty(value = "注册电话", notes = "注册电话")
private String taxPhone;
@ApiModelProperty(value = "电子发票发送邮箱", notes = "电子发票发送邮箱")
private String email;
@ApiModelProperty(value = "收件人姓名", notes = "收件人姓名")
private String receiverName;
@ApiModelProperty(value = "收件人电话", notes = "收件人电话")
private String receiverPhone;
@ApiModelProperty(value = "地址", notes = "地址")
private String receiverAddress;
@ApiModelProperty(value = "快递单号", notes = "快递单号")
private String shippingNo;
@ApiModelProperty(value = "发票下载地址", notes = "发票下载地址")
private String invoiceUrl;
@ApiModelProperty(value = "状态(1:提交,2:拒绝 3:已开票)", notes = "状态(1:提交,2:拒绝 3:已开票)")
private Integer status;
@ApiModelProperty(value = "备注", notes = "备注")
private String remark;
}
package com.dlbridge.jadp.plugins.partner.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@ApiModel(value = "赛包查询参数", description = "赛包查询参数")
@Getter
@Setter
public class InvoiceParam {
@ApiModelProperty(value = "赛事ID", notes = "赛事ID")
private Integer cmptId;
@ApiModelProperty(value = "状态(1:提交,2:已处理)", notes = "状态(1:提交,2:已处理)")
private Integer status;
@ApiModelProperty(value = "发票类型(1:普通发票,2:增值税专票)", notes = "发票类型(1:普通发票,2:增值税专票)")
private String invoiceType;
@ApiModelProperty(value = "开票方式(0:电子发票,1:纸质发票)", notes = "开票方式(0:电子发票,1:纸质发票)")
private String paperInvoice;
}
\ No newline at end of file
package com.dlbridge.jadp.plugins.partner.controller;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.dlbridge.jadp.plugins.partner.bean.BagDelivery;
import com.dlbridge.jadp.plugins.partner.bean.BagParam;
import com.dlbridge.jadp.plugins.partner.service.BagDeliveryService;
import com.neusoft.www.utils.web.Result;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("gk/bag/")
public class BagDeliveryController {
@Resource
private BagDeliveryService bagDeliveryService;
/**
* 赛包邮寄申请列表
* @param page 分页参数
* @param param 查询参数
* @return
*/
@ResponseBody
@RequestMapping(value = "/delivery/list")
public Page<List<BagDelivery>> queryBagDeliveryByPage(@ApiIgnore Pageable page, BagParam param) {
Page<List<BagDelivery>> result = bagDeliveryService.queryBagDeliveryByPage(page, param);
result.setCode(200);
return result;
}
@ResponseBody
@RequestMapping(value = "/apply", method = RequestMethod.POST)
public Result applyBagDelivery(@RequestBody BagDelivery bagDelivery) {
return bagDeliveryService.applyBagDelivery(bagDelivery);
}
@ResponseBody
@RequestMapping(value = "/update", method = RequestMethod.POST)
public Result updateBagDelivery(@RequestBody BagDelivery bagDelivery) {
return bagDeliveryService.updateBagDelivery(bagDelivery);
}
@ResponseBody
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public Result delBagDelivery(@RequestParam("id") Integer id) {
return bagDeliveryService.delBagDelivery(id);
}
}
package com.dlbridge.jadp.plugins.partner.controller;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.dlbridge.jadp.plugins.partner.bean.Invoice;
import com.dlbridge.jadp.plugins.partner.bean.BagParam;
import com.dlbridge.jadp.plugins.partner.bean.InvoiceParam;
import com.dlbridge.jadp.plugins.partner.service.InvoiceService;
import com.neusoft.www.utils.web.Result;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("gk/invoice/")
public class InvoiceController {
@Resource
private InvoiceService invoiceService;
/**
* 赛包邮寄申请列表
* @param page 分页参数
* @param param 查询参数
* @return
*/
@ResponseBody
@RequestMapping(value = "/list")
public Page<List<Invoice>> queryInvoiceByPage(@ApiIgnore Pageable page, InvoiceParam param) {
Page<List<Invoice>> result = invoiceService.queryInvoiceByPage(page, param);
result.setCode(200);
return result;
}
@ResponseBody
@RequestMapping(value = "/apply", method = RequestMethod.POST)
public Result applyInvoice(@RequestBody Invoice Invoice) {
return invoiceService.applyInvoice(Invoice);
}
@ResponseBody
@RequestMapping(value = "/update", method = RequestMethod.POST)
public Result updateInvoice(@RequestBody Invoice Invoice) {
return invoiceService.updateInvoice(Invoice);
}
@ResponseBody
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public Result delInvoice(@RequestParam("id") Integer id) {
return invoiceService.delInvoice(id);
}
}
package com.dlbridge.jadp.plugins.partner.mapper;
import com.dlbridge.jadp.plugins.partner.bean.BagDelivery;
import com.dlbridge.jadp.plugins.partner.bean.BagParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
public interface BagDeliveryMapper {
void insertBagDelivery(@Param("bag") BagDelivery bagDelivery);
void updateBagDelivery(BagDelivery bagDelivery);
void delBagDelivery(@Param("id") Integer id);
long getBagDeliveryCount(@Param("param") BagParam param);
List<BagDelivery> queryBagDeliveryByPage(@Param("page") Pageable page, @Param("param") BagParam param);
}
<?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.dlbridge.jadp.plugins.partner.mapper.BagDeliveryMapper">
<insert id="insertBagDelivery">
insert into bag_delivery(cmpt_id ,name,mark_no,phone,area,province,city,location,delivery_no,express_company,remark,status,del_flag,create_date)
values( #{bag.cmptId},#{bag.name},#{bag.markNo},#{bag.phone},#{bag.area},#{bag.province},#{bag.city},#{bag.location},#{bag.deliveryNo},#{bag.expressCompany},#{bag.remark},1,0,now())
</insert>
<update id="delBagDelivery">
update bag_delivery set del_flag = 1,update_date = now() where id = #{id}
</update>
<update id="updateBagDelivery">
update bag_delivery
set
update_date = now()
<if test="name != null">
,name=#{name}
</if>
<if test="markNo != null">
,mark_no=#{markNo}
</if>
<if test="phone != null">
,phone=#{phone}
</if>
<if test="area != null">
,area=#{area}
</if>
<if test="province != null">
,province=#{province}
</if>
<if test="city != null">
,city=#{city}
</if>
<if test="location != null">
,location=#{location}
</if>
<if test="deliveryNo != null">
,delivery_no=#{deliveryNo}
</if>
<if test="expressCompany != null">
,express_company=#{expressCompany}
</if>
<if test="remark != null">
,remark=#{remark}
</if>
<if test="status != null">
,status=#{status}
</if>
where id=#{id}
</update>
<select id="queryBagDeliveryByPage" resultType="com.dlbridge.jadp.plugins.partner.bean.BagDelivery">
select
id,
cmpt_id cmptId,
name,
mark_no markNo,
phone,
area,
province,
city,
location,
delivery_no deliveryNo,
express_company expressCompany,
remark,
status
from bag_delivery
where del_flag = 0
<include refid="bag-where-sql"/>
order by create_date
limit #{page.offset},#{page.size}
</select>
<select id="getBagDeliveryCount" resultType="long">
select count(1)
from bag_delivery
where del_flag=0
<include refid="bag-where-sql"/>
</select>
<sql id="bag-where-sql">
and cmpt_id = #{param.cmptId}
<if test="param.status != null">
and status=#{param.status}
</if>
</sql>
</mapper>
\ No newline at end of file
package com.dlbridge.jadp.plugins.partner.mapper;
import com.dlbridge.jadp.plugins.partner.bean.Invoice;
import com.dlbridge.jadp.plugins.partner.bean.InvoiceParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface InvoiceMapper {
void insertInvoice(Invoice invoice);
void updateInvoice(Invoice invoice);
void delInvoice(@Param("id") Integer id);
long getInvoiceCount(@Param("param") InvoiceParam param);
List<Invoice> queryInvoiceByPage(@Param("page") Pageable page, @Param("param") InvoiceParam param);
}
<?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.dlbridge.jadp.plugins.partner.mapper.InvoiceMapper">
<insert id="insertInvoice">
insert into invoice_record(cmpt_id, mark_no, invoice_type, paper_invoice, amount, header, tax_payer_id, tax_bank,
tax_bank_account, tax_registered_address, tax_phone,email,receiver_name,receiver_phone,
receiver_address,remark,status,del_flag, create_date)
values (#{cmptId}, #{markNo}, #{invoiceType}, #{paperInvoice}, #{amount}, #{header},#{taxPayerId}, #{taxBank},
#{taxBankAccount}, #{taxRegisteredAddress}, #{taxPhone}, #{email}, #{receiverName}, #{receiverPhone},
#{receiverAddress},#{remark}, 1, 0, now())
</insert>
<update id="delInvoice">
update invoice_record set del_flag = 1,update_date = now() where id = #{id}
</update>
<update id="updateInvoice">
update invoice_record
set
update_date = now()
<if test="markNo != null">
,mark_no=#{markNo}
</if>
<if test="invoiceType != null">
,invoice_type=#{invoiceType}
</if>
<if test="paperInvoice != null">
,paper_invoice=#{paperInvoice}
</if>
<if test="amount != null">
,amount=#{amount}
</if>
<if test="header != null">
,header=#{header}
</if>
<if test="taxPayerId != null">
,tax_payer_id=#{taxPayerId}
</if>
<if test="taxBank != null">
,tax_bank=#{taxBank}
</if>
<if test="taxBankAccount != null">
,tax_bank_account=#{taxBankAccount}
</if>
<if test="taxRegisteredAddress != null">
,tax_registered_address=#{taxRegisteredAddress}
</if>
<if test="taxPhone != null">
,tax_phone=#{taxPhone}
</if>
<if test="email != null">
,email=#{email}
</if>
<if test="receiverName != null">
,receiver_name=#{receiverName}
</if>
<if test="receiverPhone != null">
,receiver_phone=#{receiverPhone}
</if>
<if test="receiverAddress != null">
,receiver_address=#{receiverAddress}
</if>
<if test="shippingNo != null">
,shipping_no=#{shippingNo}
</if>
<if test="invoiceUrl != null">
,invoice_url=#{invoiceUrl}
</if>
<if test="remark != null">
,remark=#{remark}
</if>
<if test="status != null">
,status=#{status}
</if>
where id=#{id}
</update>
<select id="queryInvoiceByPage" resultType="com.dlbridge.jadp.plugins.partner.bean.Invoice">
select
id,
cmpt_id cmptId,
mark_no markNo,
invoice_type invoiceType,
paper_invoice paperInvoice,
amount,
header,
tax_payer_id taxPayerId,
tax_bank taxBank,
tax_bank_account taxBankAccount,
tax_registered_address taxRegisteredAddress,
tax_phone taxPhone,
email,
receiver_name receiverName,
receiver_phone receiverPhone,
receiver_address receiverAddress,
invoice_url invoiceUrl,
remark,
status
from invoice_record
where del_flag = 0
<include refid="bag-where-sql"/>
order by create_date
limit #{page.offset},#{page.size}
</select>
<select id="getInvoiceCount" resultType="long">
select count(1)
from invoice_record
where del_flag=0
<include refid="bag-where-sql"/>
</select>
<sql id="bag-where-sql">
and cmpt_id = #{param.cmptId}
<if test="param.status != null">
and status=#{param.status}
</if>
<if test="param.invoiceType != null and param.invoiceType != '' ">
and invoice_type=#{param.invoiceType}
</if>
<if test="param.paperInvoice != null and param.paperInvoice != '' ">
and paper_invoice=#{param.paperInvoice}
</if>
</sql>
</mapper>
\ No newline at end of file
package com.dlbridge.jadp.plugins.partner.service;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.dlbridge.jadp.plugins.cmpt.utils.PageFactory;
import com.dlbridge.jadp.plugins.partner.bean.BagDelivery;
import com.dlbridge.jadp.plugins.partner.bean.BagParam;
import com.dlbridge.jadp.plugins.partner.mapper.BagDeliveryMapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import com.neusoft.www.utils.web.Result;
@Service
public class BagDeliveryService {
@Resource
private BagDeliveryMapper bagDeliveryMapper;
/**
* 赛包邮寄申请列表
* @param page 分页参数
* @param param 查询参数
* @return
*/
public Page<List<BagDelivery>> queryBagDeliveryByPage(Pageable page, BagParam param) {
long count = bagDeliveryMapper.getBagDeliveryCount(param);
List<BagDelivery> list = bagDeliveryMapper.queryBagDeliveryByPage(page, param);
return PageFactory.setContent(list, page, count);
}
/**
* 赛包邮寄申请接口
* @param bagDelivery
* @return
*/
public Result applyBagDelivery(BagDelivery bagDelivery) {
if(StringUtils.isBlank(bagDelivery.getName())){
Result.fail().setMsg("姓名不能为空");
}
if(StringUtils.isBlank(bagDelivery.getMarkNo())){
Result.fail().setMsg("参赛号不能为空");
}
if(StringUtils.isBlank(bagDelivery.getPhone())){
Result.fail().setMsg("电话不能为空");
}
if(StringUtils.isBlank(bagDelivery.getLocation())){
Result.fail().setMsg("地址不能为空");
}
bagDeliveryMapper.insertBagDelivery(bagDelivery);
return Result.success();
}
/**
* 赛包邮寄申请更新接口
* @param bagDelivery
* @return
*/
public Result updateBagDelivery(BagDelivery bagDelivery) {
if(bagDelivery.getId() == null){
Result.fail().setMsg("ID不能为空");
}
bagDeliveryMapper.updateBagDelivery(bagDelivery);
return Result.success();
}
/**
* 赛包申请删除接口
* @param id
* @return
*/
public Result delBagDelivery(Integer id) {
bagDeliveryMapper.delBagDelivery(id);
return Result.success();
}
}
package com.dlbridge.jadp.plugins.partner.service;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.dlbridge.jadp.plugins.cmpt.utils.PageFactory;
import com.dlbridge.jadp.plugins.partner.bean.Invoice;
import com.dlbridge.jadp.plugins.partner.bean.InvoiceParam;
import com.dlbridge.jadp.plugins.partner.mapper.InvoiceMapper;
import com.neusoft.www.utils.web.Result;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class InvoiceService {
@Resource
private InvoiceMapper InvoiceMapper;
/**
* 发票申请列表
* @param page 分页参数
* @param param 查询参数
* @return
*/
public Page<List<Invoice>> queryInvoiceByPage(Pageable page, InvoiceParam param) {
long count = InvoiceMapper.getInvoiceCount(param);
List<Invoice> list = InvoiceMapper.queryInvoiceByPage(page, param);
return PageFactory.setContent(list, page, count);
}
/**
* 发票申请接口
* @param Invoice
* @return
*/
public Result applyInvoice(Invoice Invoice) {
if(StringUtils.isBlank(Invoice.getHeader())){
Result.fail().setMsg("发票抬头不能为空");
}
if(StringUtils.isBlank(Invoice.getMarkNo())){
Result.fail().setMsg("参赛号不能为空");
}
if(Invoice.getAmount() == null){
Result.fail().setMsg("开票金额不能为空");
}
InvoiceMapper.insertInvoice(Invoice);
return Result.success();
}
/**
* 发票申请更新接口
* @param Invoice
* @return
*/
public Result updateInvoice(Invoice Invoice) {
if(Invoice.getId() == null){
Result.fail().setMsg("ID不能为空");
}
InvoiceMapper.updateInvoice(Invoice);
return Result.success();
}
/**
* 发票申请删除接口
* @param id
* @return
*/
public Result delInvoice(Integer id) {
InvoiceMapper.delInvoice(id);
return Result.success();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment