master
Gitea 4 weeks ago
parent 2231e16c69
commit 1b97ec8b8d
  1. 315
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/innovationvoucher/controller/InnovationVoucherController.java
  2. 132
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/innovationvoucher/entity/InnovationVoucher.java
  3. 17
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/innovationvoucher/mapper/InnovationVoucherMapper.java
  4. 5
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/innovationvoucher/mapper/xml/InnovationVoucherMapper.xml
  5. 14
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/innovationvoucher/service/IInnovationVoucherService.java
  6. 19
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/innovationvoucher/service/impl/InnovationVoucherServiceImpl.java

@ -0,0 +1,315 @@
package org.jeecg.modules.demo.innovationvoucher.controller;
import java.util.Arrays;
import java.util.HashMap;
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 cn.hutool.core.util.IdUtil;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.innovationvoucher.entity.InnovationVoucher;
import org.jeecg.modules.demo.innovationvoucher.service.IInnovationVoucherService;
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.jeecg.modules.system.service.ISysDepartService;
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: 创新券表
* @Author: jeecg-boot
* @Date: 2024-10-28
* @Version: V1.0
*/
@Api(tags="创新券表")
@RestController
@RequestMapping("/innovationvoucher/innovationVoucher")
@Slf4j
public class InnovationVoucherController extends JeecgController<InnovationVoucher, IInnovationVoucherService> {
@Autowired
private IInnovationVoucherService innovationVoucherService;
@Autowired
private ISysDepartService sysDepartService;
/**
* 分页列表查询
*
* @param innovationVoucher
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "创新券表-分页列表查询")
@ApiOperation(value="创新券表-分页列表查询", notes="创新券表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<InnovationVoucher>> queryPageList(InnovationVoucher innovationVoucher,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<InnovationVoucher> queryWrapper = QueryGenerator.initQueryWrapper(innovationVoucher, req.getParameterMap());
queryWrapper.eq("pro_dept",loginUser.getOrgId());
Page<InnovationVoucher> page = new Page<InnovationVoucher>(pageNo, pageSize);
IPage<InnovationVoucher> pageList = innovationVoucherService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 分页列表查询
*
* @param innovationVoucher
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "创新券表-分页列表查询")
@ApiOperation(value="创新券表-分页列表查询", notes="创新券表-分页列表查询")
@GetMapping(value = "/list1")
public Result<IPage<InnovationVoucher>> queryPageList1(InnovationVoucher innovationVoucher,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<InnovationVoucher> queryWrapper = QueryGenerator.initQueryWrapper(innovationVoucher, req.getParameterMap());
if(loginUser.getRoleCode().indexOf("quxian_admin")!= -1){
//县区管理员角色
queryWrapper.in("state",1,2,3);
queryWrapper.in("flag",1,2);
Page<InnovationVoucher> page = new Page<InnovationVoucher>(pageNo, pageSize);
IPage<InnovationVoucher> pageList = innovationVoucherService.page(page, queryWrapper);
return Result.OK(pageList);
}
if(loginUser.getRoleCode().indexOf("kejiju_admin")!= -1){
//市科技局管理员角色
queryWrapper.in("state",2,3);
queryWrapper.in("flag",0,2);
Page<InnovationVoucher> page = new Page<InnovationVoucher>(pageNo, pageSize);
IPage<InnovationVoucher> pageList = innovationVoucherService.page(page, queryWrapper);
return Result.OK(pageList);
}
return Result.OK(null);
}
/**
* 添加
*
* @param innovationVoucher
* @return
*/
@AutoLog(value = "创新券表-添加")
@ApiOperation(value="创新券表-添加", notes="创新券表-添加")
//@RequiresPermissions("innovationvoucher:innovation_voucher:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody InnovationVoucher innovationVoucher) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
innovationVoucher.setProDept(loginUser.getOrgId());
String uuid = IdUtil.randomUUID().replaceAll("-", "");
if(sysDepartService.getById(loginUser.getOrgId()).getOrgCategory().equals("3")){
innovationVoucher.setFlag("1");
String cxqCode = "XQ";
cxqCode += uuid.substring(0, 18);
innovationVoucher.setCxqCode(cxqCode.toUpperCase());
}else {
innovationVoucher.setFlag("0");
String cxqCode = "SZ";
cxqCode += uuid.substring(0, 18);
innovationVoucher.setCxqCode(cxqCode.toUpperCase());
}
innovationVoucherService.save(innovationVoucher);
return Result.OK("申请成功!");
}
/**
* 编辑
*
* @param innovationVoucher
* @return
*/
@AutoLog(value = "创新券表-编辑")
@ApiOperation(value="创新券表-编辑", notes="创新券表-编辑")
//@RequiresPermissions("innovationvoucher:innovation_voucher:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody InnovationVoucher innovationVoucher) {
innovationVoucherService.updateById(innovationVoucher);
return Result.OK("编辑成功!");
}
/**
* 编辑
*
* @param innovationVoucher
* @return
*/
@AutoLog(value = "仪器信息表-编辑")
@ApiOperation(value="仪器信息表-编辑", notes="仪器信息表-编辑")
//@RequiresPermissions("instrument:instrument:edit")
@RequestMapping(value = "/edit1", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit2(@RequestBody InnovationVoucher innovationVoucher) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(sysDepartService.getById(loginUser.getOrgId()).getOrgCategory().equals("3")){
innovationVoucher.setFlag("1");
}else{
innovationVoucher.setFlag("0");
}
innovationVoucher.setState("4");
innovationVoucherService.updateById(innovationVoucher);
return Result.OK("驳回成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "创新券表-通过id删除")
@ApiOperation(value="创新券表-通过id删除", notes="创新券表-通过id删除")
//@RequiresPermissions("innovationvoucher:innovation_voucher:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
innovationVoucherService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "创新券表-批量删除")
@ApiOperation(value="创新券表-批量删除", notes="创新券表-批量删除")
//@RequiresPermissions("innovationvoucher:innovation_voucher:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.innovationVoucherService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "创新券表-通过id查询")
@ApiOperation(value="创新券表-通过id查询", notes="创新券表-通过id查询")
@GetMapping(value = "/queryById")
public Result<InnovationVoucher> queryById(@RequestParam(name="id",required=true) String id) {
InnovationVoucher innovationVoucher = innovationVoucherService.getById(id);
if(innovationVoucher==null) {
return Result.error("未找到对应数据");
}
return Result.OK(innovationVoucher);
}
/**
* 提交审核
*
* @param id
* @return
*/
//@AutoLog(value = "提交审核")
@ApiOperation(value="提交审核", notes="提交审核")
@GetMapping(value = "/tjsh")
public Result<InnovationVoucher> tjsh(@RequestParam(name="id",required=true) String id) {
InnovationVoucher innovationVoucher = innovationVoucherService.getById(id);
if(innovationVoucher==null) {
return Result.error("未找到对应数据");
}
if(innovationVoucher.getFlag().equals("0")){
innovationVoucher.setState("2");
}else {
innovationVoucher.setState("1");
}
innovationVoucher.setReject("");
innovationVoucherService.updateById(innovationVoucher);
return Result.OK("提交审核成功!");
}
/**
* 审核通过
*
* @param id
* @return
*/
//@AutoLog(value = "审核通过")
@ApiOperation(value="审核通过", notes="审核通过")
@GetMapping(value = "/shtg")
public Result<InnovationVoucher> shtg(@RequestParam(name="id",required=true) String id) {
InnovationVoucher innovationVoucher = innovationVoucherService.getById(id);
if(innovationVoucher==null) {
return Result.error("未找到对应数据");
}
if(innovationVoucher.getFlag().equals("0")){
innovationVoucher.setState("3");
}
if(innovationVoucher.getFlag().equals("1")){
innovationVoucher.setState("2");
innovationVoucher.setFlag("2");
}
if(innovationVoucher.getFlag().equals("2")&&innovationVoucher.getState().equals("2")){
innovationVoucher.setState("3");
}
//instrument.setFlag("2");
innovationVoucherService.updateById(innovationVoucher);
return Result.OK("审核通过成功!");
}
/**
* 导出excel
*
* @param request
* @param innovationVoucher
*/
//@RequiresPermissions("innovationvoucher:innovation_voucher:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, InnovationVoucher innovationVoucher) {
return super.exportXls(request, innovationVoucher, InnovationVoucher.class, "创新券表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
//@RequiresPermissions("innovationvoucher:innovation_voucher:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, InnovationVoucher.class);
}
}

@ -0,0 +1,132 @@
package org.jeecg.modules.demo.innovationvoucher.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 org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
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: 创新券表
* @Author: jeecg-boot
* @Date: 2024-10-28
* @Version: V1.0
*/
@Data
@TableName("innovation_voucher")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="innovation_voucher对象", description="创新券表")
public class InnovationVoucher 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;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**创新券编码*/
@Excel(name = "创新券编码", width = 15)
@ApiModelProperty(value = "创新券编码")
private java.lang.String cxqCode;
/**申报项目名称*/
@Excel(name = "申报项目名称", width = 15)
@ApiModelProperty(value = "申报项目名称")
private java.lang.String proName;
/**申报类别*/
@Excel(name = "申报类别", width = 15, dicCode = "cxq_type")
@Dict(dicCode = "cxq_type")
@ApiModelProperty(value = "申报类别")
private java.lang.String proType;
/**申领金额*/
@Excel(name = "申领金额", width = 15)
@ApiModelProperty(value = "申领金额")
private java.lang.Double proMoney;
/**附件*/
@Excel(name = "附件", width = 15)
@ApiModelProperty(value = "附件")
private java.lang.String attachment;
/**申领单位*/
@Excel(name = "申领单位", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "申领单位")
private java.lang.String proDept;
/**使用单位*/
@Excel(name = "使用单位", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "使用单位")
private java.lang.String applyDept;
/**是否同意*/
@Excel(name = "是否同意", width = 15, dicCode = "cxq_sf_sta")
@Dict(dicCode = "cxq_sf_sta")
@ApiModelProperty(value = "是否同意")
private java.lang.String sfState;
/**审核状态*/
@Excel(name = "审核状态", width = 15, dicCode = "in_exam_status")
@Dict(dicCode = "in_exam_status")
@ApiModelProperty(value = "审核状态")
private java.lang.String state;
/**审核标识*/
@Excel(name = "审核标识", width = 15)
@ApiModelProperty(value = "审核标识")
private java.lang.String flag;
/**使用状态*/
@Excel(name = "使用状态", width = 15, dicCode = "cxq_use_sta")
@Dict(dicCode = "cxq_use_sta")
@ApiModelProperty(value = "使用状态")
private java.lang.String useState;
/**驳回原因*/
@Excel(name = "驳回原因", width = 15)
@ApiModelProperty(value = "驳回原因")
private java.lang.String reject;
/**是否申请兑现*/
@Excel(name = "是否申请兑现", width = 15, dicCode = "sqdx_sf")
@Dict(dicCode = "sqdx_sf")
@ApiModelProperty(value = "是否申请兑现")
private java.lang.String sfSqdxSta;
/**兑现审核状态*/
@Excel(name = "兑现审核状态", width = 15, dicCode = "in_exam_status")
@Dict(dicCode = "in_exam_status")
@ApiModelProperty(value = "兑现审核状态")
private java.lang.String dxshSta;
/**兑现审核标识*/
@Excel(name = "兑现审核标识", width = 15)
@ApiModelProperty(value = "兑现审核标识")
private java.lang.String dxshFlag;
/**兑现驳回原因*/
@Excel(name = "兑现驳回原因", width = 15)
@ApiModelProperty(value = "兑现驳回原因")
private java.lang.String dxReject;
}

@ -0,0 +1,17 @@
package org.jeecg.modules.demo.innovationvoucher.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.demo.innovationvoucher.entity.InnovationVoucher;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 创新券表
* @Author: jeecg-boot
* @Date: 2024-10-28
* @Version: V1.0
*/
public interface InnovationVoucherMapper extends BaseMapper<InnovationVoucher> {
}

@ -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.demo.innovationvoucher.mapper.InnovationVoucherMapper">
</mapper>

@ -0,0 +1,14 @@
package org.jeecg.modules.demo.innovationvoucher.service;
import org.jeecg.modules.demo.innovationvoucher.entity.InnovationVoucher;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 创新券表
* @Author: jeecg-boot
* @Date: 2024-10-28
* @Version: V1.0
*/
public interface IInnovationVoucherService extends IService<InnovationVoucher> {
}

@ -0,0 +1,19 @@
package org.jeecg.modules.demo.innovationvoucher.service.impl;
import org.jeecg.modules.demo.innovationvoucher.entity.InnovationVoucher;
import org.jeecg.modules.demo.innovationvoucher.mapper.InnovationVoucherMapper;
import org.jeecg.modules.demo.innovationvoucher.service.IInnovationVoucherService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 创新券表
* @Author: jeecg-boot
* @Date: 2024-10-28
* @Version: V1.0
*/
@Service
public class InnovationVoucherServiceImpl extends ServiceImpl<InnovationVoucherMapper, InnovationVoucher> implements IInnovationVoucherService {
}
Loading…
Cancel
Save