Commit 453bb7ab by 吴迪

【修改】投资计划、字典表相关代码

parent 2289b252
...@@ -231,6 +231,18 @@ ...@@ -231,6 +231,18 @@
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>${lombok.version}</version> <version>${lombok.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.sitech</groupId>
<artifactId>idwork-starter</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
/** /**
* Copyright (c) 2016-2019 人人开源 All rights reserved. *GS1OfficeWebSit
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/ */
package com.wangtian.common.utils; package com.wangtian.common.utils;
...@@ -25,6 +21,8 @@ import java.util.Date; ...@@ -25,6 +21,8 @@ import java.util.Date;
public class DateUtils { public class DateUtils {
/** 时间格式(yyyy-MM-dd) */ /** 时间格式(yyyy-MM-dd) */
public final static String DATE_PATTERN = "yyyy-MM-dd"; public final static String DATE_PATTERN = "yyyy-MM-dd";
public final static String DATE_PATTERN_1 = "yyyy/MM/dd";
/** 时间格式(yyyy-MM-dd HH:mm:ss) */ /** 时间格式(yyyy-MM-dd HH:mm:ss) */
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
......
...@@ -4,7 +4,6 @@ import com.wangtian.common.utils.PageUtils; ...@@ -4,7 +4,6 @@ import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.R; import com.wangtian.common.utils.R;
import com.wangtian.modules.manage.entity.InvestmentPlanEntity; import com.wangtian.modules.manage.entity.InvestmentPlanEntity;
import com.wangtian.modules.manage.service.InvestmentPlanService; import com.wangtian.modules.manage.service.InvestmentPlanService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -42,7 +41,7 @@ public class InvestmentPlanController { ...@@ -42,7 +41,7 @@ public class InvestmentPlanController {
* 信息 * 信息
*/ */
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
@RequiresPermissions("manage:investmentplan:info") //@RequiresPermissions("manage:investmentplan:info")
public R info(@PathVariable("id") Long id){ public R info(@PathVariable("id") Long id){
InvestmentPlanEntity investmentPlan = investmentPlanService.getById(id); InvestmentPlanEntity investmentPlan = investmentPlanService.getById(id);
......
package com.wangtian.modules.manage.controller; package com.wangtian.modules.manage.controller;
import cn.hutool.core.bean.BeanUtil;
import com.sitech.idworkstarter.IdWorkService;
import com.wangtian.common.utils.PageUtils; import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.R; import com.wangtian.common.utils.R;
import com.wangtian.common.validator.ValidatorUtils;
import com.wangtian.common.validator.group.AddGroup;
import com.wangtian.common.validator.group.UpdateGroup;
import com.wangtian.modules.manage.entity.SysDictEntity; import com.wangtian.modules.manage.entity.SysDictEntity;
import com.wangtian.modules.manage.form.SysDictForm;
import com.wangtian.modules.manage.service.SysDictService; import com.wangtian.modules.manage.service.SysDictService;
import com.wangtian.modules.sys.controller.AbstractController;
import com.wangtian.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.Map; import java.util.Map;
...@@ -21,9 +30,11 @@ import java.util.Map; ...@@ -21,9 +30,11 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("manage/sysdict") @RequestMapping("manage/sysdict")
public class SysDictController { public class SysDictController extends AbstractController {
@Autowired @Autowired
private SysDictService sysDictService; private SysDictService sysDictService;
@Autowired
private IdWorkService idWorkService;
/** /**
* 列表 * 列表
...@@ -32,7 +43,6 @@ public class SysDictController { ...@@ -32,7 +43,6 @@ public class SysDictController {
//@RequiresPermissions("manage:sysdict:list") //@RequiresPermissions("manage:sysdict:list")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysDictService.queryPage(params); PageUtils page = sysDictService.queryPage(params);
return R.ok().put("page", page); return R.ok().put("page", page);
} }
...@@ -42,9 +52,8 @@ public class SysDictController { ...@@ -42,9 +52,8 @@ public class SysDictController {
*/ */
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
//@RequiresPermissions("manage:sysdict:info") //@RequiresPermissions("manage:sysdict:info")
public R info(@PathVariable("id") Long id){ public R info(@PathVariable("id") String id){
SysDictEntity sysDict = sysDictService.getById(id); SysDictEntity sysDict = sysDictService.getById(id);
return R.ok().put("sysDict", sysDict); return R.ok().put("sysDict", sysDict);
} }
...@@ -53,9 +62,19 @@ public class SysDictController { ...@@ -53,9 +62,19 @@ public class SysDictController {
*/ */
@RequestMapping("/save") @RequestMapping("/save")
// @RequiresPermissions("manage:sysdict:save") // @RequiresPermissions("manage:sysdict:save")
public R save(@RequestBody SysDictEntity sysDict){ public R save(@RequestBody SysDictForm sysDict){
sysDictService.save(sysDict); //校验参数
ValidatorUtils.validateEntity(sysDict, AddGroup.class);
//转化实体对象
SysDictEntity sysDictEntity = new SysDictEntity();
BeanUtil.copyProperties(sysDict,sysDictEntity);
sysDictEntity.setId(idWorkService.getSEQByKey("id_seq"));
//获取登录用户信息
SysUserEntity loginUser = getUser();
sysDictEntity.setCreateUserId(loginUser.getUserId());
sysDictEntity.setCreateUserName(loginUser.getUsername());
sysDictEntity.setCreateTime(new Date());
sysDictService.save(sysDictEntity);
return R.ok(); return R.ok();
} }
...@@ -64,9 +83,17 @@ public class SysDictController { ...@@ -64,9 +83,17 @@ public class SysDictController {
*/ */
@RequestMapping("/update") @RequestMapping("/update")
//@RequiresPermissions("manage:sysdict:update") //@RequiresPermissions("manage:sysdict:update")
public R update(@RequestBody SysDictEntity sysDict){ public R update(@RequestBody SysDictForm sysDict){
sysDictService.updateById(sysDict); ValidatorUtils.validateEntity(sysDict, UpdateGroup.class);
//转化实体对象
SysDictEntity sysDictEntity = new SysDictEntity();
BeanUtil.copyProperties(sysDict,sysDictEntity);
//获取登录用户信息
SysUserEntity loginUser = getUser();
sysDictEntity.setUpdateTime(new Date());
sysDictEntity.setUpdateUserName(loginUser.getUsername());
sysDictEntity.setUpdateUserId(loginUser.getUserId());
sysDictService.updateById(sysDictEntity);
return R.ok(); return R.ok();
} }
...@@ -75,9 +102,8 @@ public class SysDictController { ...@@ -75,9 +102,8 @@ public class SysDictController {
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
//@RequiresPermissions("manage:sysdict:delete") //@RequiresPermissions("manage:sysdict:delete")
public R delete(@RequestBody Long[] ids){ public R delete(@RequestBody String[] ids){
sysDictService.removeByIds(Arrays.asList(ids)); sysDictService.removeByIds(Arrays.asList(ids));
return R.ok(); return R.ok();
} }
......
...@@ -42,7 +42,7 @@ public class SysDictItemController { ...@@ -42,7 +42,7 @@ public class SysDictItemController {
*/ */
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
//@RequiresPermissions("manage:sysdictitem:info") //@RequiresPermissions("manage:sysdictitem:info")
public R info(@PathVariable("id") Long id){ public R info(@PathVariable("id") String id){
SysDictItemEntity sysDictItem = sysDictItemService.getById(id); SysDictItemEntity sysDictItem = sysDictItemService.getById(id);
return R.ok().put("sysDictItem", sysDictItem); return R.ok().put("sysDictItem", sysDictItem);
...@@ -75,7 +75,7 @@ public class SysDictItemController { ...@@ -75,7 +75,7 @@ public class SysDictItemController {
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
// @RequiresPermissions("manage:sysdictitem:delete") // @RequiresPermissions("manage:sysdictitem:delete")
public R delete(@RequestBody Long[] ids){ public R delete(@RequestBody String[] ids){
sysDictItemService.removeByIds(Arrays.asList(ids)); sysDictItemService.removeByIds(Arrays.asList(ids));
return R.ok(); return R.ok();
......
...@@ -25,7 +25,7 @@ public class InvestmentPlanEntity implements Serializable { ...@@ -25,7 +25,7 @@ public class InvestmentPlanEntity implements Serializable {
* 主键,通过idwork-starter生成 * 主键,通过idwork-starter生成
*/ */
@TableId @TableId
private Long id; private String id;
/** /**
* 投资计划名称 * 投资计划名称
*/ */
......
package com.wangtian.modules.manage.entity; package com.wangtian.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -22,8 +21,8 @@ public class SysDictEntity implements Serializable { ...@@ -22,8 +21,8 @@ public class SysDictEntity implements Serializable {
/** /**
* 主键,idwork-starter生成 * 主键,idwork-starter生成
*/ */
@TableId @TableId(type = IdType.INPUT)
private Long id; private String id;
/** /**
* 字典名称 * 字典名称
*/ */
...@@ -64,6 +63,7 @@ public class SysDictEntity implements Serializable { ...@@ -64,6 +63,7 @@ public class SysDictEntity implements Serializable {
/** /**
* 修改时间 * 修改时间
*/ */
private Date updateTime; private Date updateTime;
/** /**
* 创建时间 * 创建时间
...@@ -72,6 +72,7 @@ public class SysDictEntity implements Serializable { ...@@ -72,6 +72,7 @@ public class SysDictEntity implements Serializable {
/** /**
* 是否删除 0/未删除,1/删除 * 是否删除 0/未删除,1/删除
*/ */
@TableLogic
private Integer isDelete; private Integer isDelete;
} }
package com.wangtian.modules.manage.entity; package com.wangtian.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* 数据字段条目表 * 数据字段条目表
* *
* @author wudi * @author wudi
* @email 632132852@qq.com * @email 632132852@qq.com
* @date 2023-07-16 08:23:26 * @date 2023-07-16 08:23:26
...@@ -20,14 +21,14 @@ public class SysDictItemEntity implements Serializable { ...@@ -20,14 +21,14 @@ public class SysDictItemEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
@TableId @TableId
private Long id; private String id;
/** /**
* 字典id * 字典id
*/ */
private Long dictId; private String dictId;
/** /**
* 字典项文本 * 字典项文本
*/ */
...@@ -76,6 +77,7 @@ public class SysDictItemEntity implements Serializable { ...@@ -76,6 +77,7 @@ public class SysDictItemEntity implements Serializable {
/** /**
* 是否删除 0/未删除,1/删除 * 是否删除 0/未删除,1/删除
*/ */
@TableLogic
private Integer isDelete; private Integer isDelete;
} }
package com.wangtian.modules.manage.form;
import com.wangtian.common.validator.group.AddGroup;
import com.wangtian.common.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author wudi
* @date 2023/7/16
* @comment
*/
@Data
public class InvestmentPlanForm implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "投资计划ID不能为空",groups = { UpdateGroup.class})
private String id;
/**
* 投资计划名称
*/
@NotBlank(message = "投资计划名称不能为空",groups = {AddGroup.class, UpdateGroup.class})
private String planName;
/**
* 投资计划类型,使用Java枚举类维护
*/
@NotBlank(message = "投资计划类型不能为空",groups = {AddGroup.class, UpdateGroup.class})
private Integer planType;
/**
* 年度
*/
@NotBlank(message = "年度不能为空",groups = {AddGroup.class, UpdateGroup.class})
private String planYear;
/**
* 批次
*/
@NotBlank(message = "批次不能为空",groups = {AddGroup.class, UpdateGroup.class})
private String planBatchNumber;
/**
* 计划文号
*/
@NotBlank(message = "计划文号不能为空",groups = {AddGroup.class, UpdateGroup.class})
private String planNumber;
/**
* 资本性金额(万元)
*/
@NotBlank(message = "资本性金额不能为空",groups = {AddGroup.class, UpdateGroup.class})
private BigDecimal planCapitalAmount;
/**
* 成本性金额(万元)
*/
@NotBlank(message = "成本性金额不能为空",groups = {AddGroup.class, UpdateGroup.class})
private BigDecimal planCostAmount;
/**
* 投资计划下达时间
*/
@NotBlank(message = "投资计划下达时间不能为空",groups = {AddGroup.class, UpdateGroup.class})
private Date planDeliveryTime;
/**
* 下达备注
*/
private String planRemarks;
}
package com.wangtian.modules.manage.form;
import com.wangtian.common.validator.group.AddGroup;
import com.wangtian.common.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author wudi
* @date 2023/7/16
* @comment
*/
@Data
public class SysDictForm implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "商品分类ID不能为空",groups = { UpdateGroup.class})
private String id;
/**
* 字典名称
*/
@NotBlank(message = "字典名称",groups = {AddGroup.class, UpdateGroup.class})
private String dictName;
/**
* 字典编码
*/
@NotBlank(message = "字典编码",groups = {AddGroup.class, UpdateGroup.class})
private String dictCode;
/**
* 描述
*/
@NotBlank(message = "字典编码",groups = {AddGroup.class, UpdateGroup.class})
private String description;
}
package com.wangtian.modules.manage.service.impl; package com.wangtian.modules.manage.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wangtian.common.utils.PageUtils; import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.Query; import com.wangtian.common.utils.Query;
import com.wangtian.modules.manage.dao.InvestmentPlanDao; import com.wangtian.modules.manage.dao.InvestmentPlanDao;
import com.wangtian.modules.manage.entity.InvestmentPlanEntity; import com.wangtian.modules.manage.entity.InvestmentPlanEntity;
import com.wangtian.modules.manage.service.InvestmentPlanService; import com.wangtian.modules.manage.service.InvestmentPlanService;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service("investmentPlanService") @Service("investmentPlanService")
...@@ -20,7 +20,7 @@ public class InvestmentPlanServiceImpl extends ServiceImpl<InvestmentPlanDao, In ...@@ -20,7 +20,7 @@ public class InvestmentPlanServiceImpl extends ServiceImpl<InvestmentPlanDao, In
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<InvestmentPlanEntity> page = this.page( IPage<InvestmentPlanEntity> page = this.page(
new Query<InvestmentPlanEntity>().getPage(params), new Query<InvestmentPlanEntity>().getPage(params),
new QueryWrapper<InvestmentPlanEntity>() new QueryWrapper<InvestmentPlanEntity>().eq("is_publish",1)
); );
return new PageUtils(page); return new PageUtils(page);
......
...@@ -20,7 +20,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictI ...@@ -20,7 +20,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictI
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<SysDictItemEntity> page = this.page( IPage<SysDictItemEntity> page = this.page(
new Query<SysDictItemEntity>().getPage(params), new Query<SysDictItemEntity>().getPage(params),
new QueryWrapper<SysDictItemEntity>() new QueryWrapper<SysDictItemEntity>().eq("is_publish",1)
); );
return new PageUtils(page); return new PageUtils(page);
......
...@@ -8,6 +8,7 @@ import com.wangtian.common.utils.Query; ...@@ -8,6 +8,7 @@ import com.wangtian.common.utils.Query;
import com.wangtian.modules.manage.dao.SysDictDao; import com.wangtian.modules.manage.dao.SysDictDao;
import com.wangtian.modules.manage.entity.SysDictEntity; import com.wangtian.modules.manage.entity.SysDictEntity;
import com.wangtian.modules.manage.service.SysDictService; import com.wangtian.modules.manage.service.SysDictService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
...@@ -21,6 +22,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictDao, SysDictEntity> i ...@@ -21,6 +22,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictDao, SysDictEntity> i
IPage<SysDictEntity> page = this.page( IPage<SysDictEntity> page = this.page(
new Query<SysDictEntity>().getPage(params), new Query<SysDictEntity>().getPage(params),
new QueryWrapper<SysDictEntity>() new QueryWrapper<SysDictEntity>()
.eq("is_publish", 1)
.like((null != params.get("dictName") && StringUtils.isNotBlank(params.get("dictName").toString())), "dict_name", params.get("dictName"))
); );
return new PageUtils(page); return new PageUtils(page);
......
...@@ -81,3 +81,13 @@ renren: ...@@ -81,3 +81,13 @@ renren:
# token有效时长,7天,单位秒 # token有效时长,7天,单位秒
expire: 604800 expire: 604800
header: token header: token
#idwork要初始化的key名称,如果是多个,号隔开(集合)
id.work.idWorkKeyList: id_seq
#需要初始化的大小,单位(个)
id.work.size: 10000
#机器的序号 0-31都可用,如果是分布式部署,需要定义不同的workerId
id.work.workerId: 0
#机器的数据中心 0-31都可用,如果是分布式部署,需要定义不同的datacenterId
id.work.datacenterId: 1
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