feature: (WIP) Credit Page

pull/6221/head
Gauthier LO 2023-08-24 16:35:27 +02:00
parent ba9ba76a7e
commit 14ae44058f
12 changed files with 631 additions and 0 deletions

View File

@ -0,0 +1,171 @@
package org.jeecg.modules.business.controller.admin;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.business.entity.Credit;
import org.jeecg.modules.business.service.ICreditService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description: credit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
@Api(tags="credit")
@RestController
@RequestMapping("/credit")
@Slf4j
public class CreditController extends JeecgController<Credit, ICreditService> {
@Autowired
private ICreditService creditService;
/**
*
*
* @param credit
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "credit-分页列表查询")
@ApiOperation(value="credit-分页列表查询", notes="credit-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<Credit>> queryPageList(Credit credit,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Credit> queryWrapper = QueryGenerator.initQueryWrapper(credit, req.getParameterMap());
Page<Credit> page = new Page<Credit>(pageNo, pageSize);
IPage<Credit> pageList = creditService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
*
*
* @param credit
* @return
*/
@AutoLog(value = "credit-添加")
@ApiOperation(value="credit-添加", notes="credit-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody Credit credit) {
creditService.save(credit);
return Result.OK("添加成功!");
}
/**
*
*
* @param credit
* @return
*/
@AutoLog(value = "credit-编辑")
@ApiOperation(value="credit-编辑", notes="credit-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody Credit credit) {
creditService.updateById(credit);
return Result.OK("编辑成功!");
}
/**
* id
*
* @param id
* @return
*/
@AutoLog(value = "credit-通过id删除")
@ApiOperation(value="credit-通过id删除", notes="credit-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
creditService.removeById(id);
return Result.OK("删除成功!");
}
/**
*
*
* @param ids
* @return
*/
@AutoLog(value = "credit-批量删除")
@ApiOperation(value="credit-批量删除", notes="credit-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.creditService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* id
*
* @param id
* @return
*/
//@AutoLog(value = "credit-通过id查询")
@ApiOperation(value="credit-通过id查询", notes="credit-通过id查询")
@GetMapping(value = "/queryById")
public Result<Credit> queryById(@RequestParam(name="id",required=true) String id) {
Credit credit = creditService.getById(id);
if(credit==null) {
return Result.error("未找到对应数据");
}
return Result.OK(credit);
}
/**
* excel
*
* @param request
* @param credit
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Credit credit) {
return super.exportXls(request, credit, Credit.class, "credit");
}
/**
* excel
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, Credit.class);
}
}

View File

@ -0,0 +1,178 @@
package org.jeecg.modules.business.controller.admin;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.business.entity.Debit;
import org.jeecg.modules.business.service.IDebitService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description: debit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
@Api(tags="debit")
@RestController
@RequestMapping("/business/debit")
@Slf4j
public class DebitController extends JeecgController<Debit, IDebitService> {
@Autowired
private IDebitService debitService;
/**
*
*
* @param debit
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "debit-分页列表查询")
@ApiOperation(value="debit-分页列表查询", notes="debit-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<Debit>> queryPageList(Debit debit,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Debit> queryWrapper = QueryGenerator.initQueryWrapper(debit, req.getParameterMap());
Page<Debit> page = new Page<Debit>(pageNo, pageSize);
IPage<Debit> pageList = debitService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
*
*
* @param debit
* @return
*/
@AutoLog(value = "debit-添加")
@ApiOperation(value="debit-添加", notes="debit-添加")
@RequiresPermissions("business:debit:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody Debit debit) {
debitService.save(debit);
return Result.OK("添加成功!");
}
/**
*
*
* @param debit
* @return
*/
@AutoLog(value = "debit-编辑")
@ApiOperation(value="debit-编辑", notes="debit-编辑")
@RequiresPermissions("business:debit:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody Debit debit) {
debitService.updateById(debit);
return Result.OK("编辑成功!");
}
/**
* id
*
* @param id
* @return
*/
@AutoLog(value = "debit-通过id删除")
@ApiOperation(value="debit-通过id删除", notes="debit-通过id删除")
@RequiresPermissions("business:debit:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
debitService.removeById(id);
return Result.OK("删除成功!");
}
/**
*
*
* @param ids
* @return
*/
@AutoLog(value = "debit-批量删除")
@ApiOperation(value="debit-批量删除", notes="debit-批量删除")
@RequiresPermissions("business:debit:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.debitService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* id
*
* @param id
* @return
*/
//@AutoLog(value = "debit-通过id查询")
@ApiOperation(value="debit-通过id查询", notes="debit-通过id查询")
@GetMapping(value = "/queryById")
public Result<Debit> queryById(@RequestParam(name="id",required=true) String id) {
Debit debit = debitService.getById(id);
if(debit==null) {
return Result.error("未找到对应数据");
}
return Result.OK(debit);
}
/**
* excel
*
* @param request
* @param debit
*/
@RequiresPermissions("business:debit:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Debit debit) {
return super.exportXls(request, debit, Debit.class, "debit");
}
/**
* excel
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("business:debit:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, Debit.class);
}
}

View File

@ -0,0 +1,98 @@
package org.jeecg.modules.business.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: credit
* @Author: jeecg-boot
* @Date: 2023-08-24
* @Version: V1.0
*/
@Data
@TableName("credit")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="credit对象", description="credit")
public class Credit implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**client_id*/
@Excel(name = "client_id", width = 15, dictTable = "client", dicText = "internal_code", dicCode = "id")
@Dict(dictTable = "client", dicText = "internal_code", dicCode = "id")
@ApiModelProperty(value = "client_id")
private java.lang.String clientId;
/**amount*/
@Excel(name = "amount", width = 15)
@ApiModelProperty(value = "amount")
private java.math.BigDecimal amount;
/**currency_id*/
@Excel(name = "currency_id", width = 15, dictTable = "currency WHERE code <> 'RMB'", dicText = "code", dicCode = "id")
@Dict(dictTable = "currency WHERE code <> 'RMB'", dicText = "code", dicCode = "id")
@ApiModelProperty(value = "currency_id")
private java.lang.String currencyId;
/**proof*/
@Excel(name = "proof", width = 15)
private transient java.lang.String paymentProofString;
private byte[] paymentProof;
public byte[] getPaymentProof(){
if(paymentProofString==null){
return null;
}
try {
return paymentProofString.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
public String getPaymentProofString(){
if(paymentProof==null || paymentProof.length==0){
return "";
}
try {
return new String(paymentProof,"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return "";
}
}

View File

@ -0,0 +1,66 @@
package org.jeecg.modules.business.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: debit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
@Data
@TableName("debit")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="debit对象", description="debit")
public class Debit implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**client_id*/
@Excel(name = "client_id", width = 15)
@ApiModelProperty(value = "client_id")
private java.lang.String clientId;
/**amount*/
@Excel(name = "amount", width = 15)
@ApiModelProperty(value = "amount")
private java.math.BigDecimal amount;
/**currency_id*/
@Excel(name = "currency_id", width = 15)
@ApiModelProperty(value = "currency_id")
private java.lang.String currencyId;
/**invoice_number*/
@Excel(name = "invoice_number", width = 15)
@ApiModelProperty(value = "invoice_number")
private java.lang.String invoiceNumber;
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.business.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.business.entity.Credit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @Description: credit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
@Repository
public interface CreditMapper extends BaseMapper<Credit> {
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.business.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.business.entity.Debit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @Description: debit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
@Repository
public interface DebitMapper extends BaseMapper<Debit> {
}

View File

@ -0,0 +1,5 @@
<?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="org.jeecg.modules.business.mapper.CreditMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?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="org.jeecg.modules.business.mapper.DebitMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.business.service;
import org.jeecg.modules.business.entity.Credit;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: credit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
public interface ICreditService extends IService<Credit> {
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.business.service;
import org.jeecg.modules.business.entity.Debit;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: debit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
public interface IDebitService extends IService<Debit> {
}

View File

@ -0,0 +1,21 @@
package org.jeecg.modules.business.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.business.entity.Credit;
import org.jeecg.modules.business.mapper.CreditMapper;
import org.jeecg.modules.business.service.ICreditService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: credit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
@Service
@Slf4j
public class CreditServiceImpl extends ServiceImpl<CreditMapper, Credit> implements ICreditService {
}

View File

@ -0,0 +1,21 @@
package org.jeecg.modules.business.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.business.entity.Debit;
import org.jeecg.modules.business.mapper.DebitMapper;
import org.jeecg.modules.business.service.IDebitService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: debit
* @Author: jeecg-boot
* @Date: 2023-08-23
* @Version: V1.0
*/
@Service
@Slf4j
public class DebitServiceImpl extends ServiceImpl<DebitMapper, Debit> implements IDebitService {
}