Commit 86b4cbee by 吴迪

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

parent c9f2c1b7
package com.wangtian.modules.manage.controller;
import cn.hutool.core.bean.BeanUtil;
import com.wangtian.common.annotation.SysLog;
import com.wangtian.common.utils.PageUtils;
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.InvestmentPlanEntity;
import com.wangtian.modules.manage.form.InvestmentPlanForm;
import com.wangtian.modules.manage.service.InvestmentPlanService;
import com.wangtian.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -11,17 +18,16 @@ import java.util.Arrays;
import java.util.Map;
/**
* 投资计划管理表
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-16 08:23:26
* @date 2023-07-16 17:09:57
*/
@RestController
@RequestMapping("manage/investmentplan")
public class InvestmentPlanController {
public class InvestmentPlanController extends AbstractController {
@Autowired
private InvestmentPlanService investmentPlanService;
......@@ -29,8 +35,8 @@ public class InvestmentPlanController {
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:investmentplan:list")
public R list(@RequestParam Map<String, Object> params){
//@RequiresPermissions("manage:investmentplan:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = investmentPlanService.queryPage(params);
return R.ok().put("data", page);
......@@ -42,42 +48,52 @@ public class InvestmentPlanController {
*/
@RequestMapping("/info/{id}")
//@RequiresPermissions("manage:investmentplan:info")
public R info(@PathVariable("id") Long id){
InvestmentPlanEntity investmentPlan = investmentPlanService.getById(id);
public R info(@PathVariable("id") String id) {
InvestmentPlanEntity investmentPlan = investmentPlanService.getById(id);
return R.ok().put("data", investmentPlan);
}
/**
* 保存
*/
@SysLog("保存投资计划管理")
@RequestMapping("/save")
// @RequiresPermissions("manage:investmentplan:save")
public R save(@RequestBody InvestmentPlanEntity investmentPlan){
investmentPlanService.save(investmentPlan);
//@RequiresPermissions("manage:investmentplan:save")
public R save(@RequestBody InvestmentPlanForm investmentPlan) {
//校验参数
ValidatorUtils.validateEntity(investmentPlan, AddGroup.class);
//转化实体对象
InvestmentPlanEntity investmentPlanEntity = new InvestmentPlanEntity();
BeanUtil.copyProperties(investmentPlan, investmentPlanEntity);
investmentPlanService.saveInvestmentPlan(investmentPlanEntity, getUser());
return R.ok();
}
/**
* 修改
*/
@SysLog("修改投资计划管理")
@RequestMapping("/update")
// @RequiresPermissions("manage:investmentplan:update")
public R update(@RequestBody InvestmentPlanEntity investmentPlan){
investmentPlanService.updateById(investmentPlan);
//@RequiresPermissions("manage:investmentplan:update")
public R update(@RequestBody InvestmentPlanForm investmentPlan) {
ValidatorUtils.validateEntity(investmentPlan, UpdateGroup.class);
//转化实体对象
InvestmentPlanEntity investmentPlanEntity = new InvestmentPlanEntity();
BeanUtil.copyProperties(investmentPlan, investmentPlanEntity);
investmentPlanService.updateInvestmentPlanById(investmentPlanEntity, getUser());
return R.ok();
}
/**
* 删除
*/
@SysLog("删除投资计划管理")
@RequestMapping("/delete")
// @RequiresPermissions("manage:investmentplan:delete")
public R delete(@RequestBody Long[] ids){
investmentPlanService.removeByIds(Arrays.asList(ids));
//@RequiresPermissions("manage:investmentplan:delete")
public R delete(@RequestBody String[] ids) {
investmentPlanService.removeByIds(Arrays.asList(ids));
return R.ok();
}
......
......@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-16 08:23:26
* @date 2023-07-16 17:09:57
*/
@Mapper
public interface InvestmentPlanDao extends BaseMapper<InvestmentPlanEntity> {
......
package com.wangtian.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 投资计划管理表
*
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-16 08:23:26
* @date 2023-07-16 17:09:57
*/
@Data
@TableName("pm_investment_plan")
......@@ -99,7 +98,6 @@ public class InvestmentPlanEntity implements Serializable {
* 是否删除 0/未删除,1/删除
*/
@TableLogic
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;
......@@ -12,62 +11,63 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 投资计划管理表
*
* @author wudi
* @date 2023/7/16
* @comment
* @email 632132852@qq.com
* @date 2023-07-16 17:09:57
*/
@Data
public class InvestmentPlanForm implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@NotNull(message = "投资计划ID不能为空",groups = { UpdateGroup.class})
private String id;
@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;
/**
* 投资计划名称
*/
@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;
}
......@@ -3,6 +3,8 @@ package com.wangtian.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wangtian.common.utils.PageUtils;
import com.wangtian.modules.manage.entity.InvestmentPlanEntity;
import org.springframework.transaction.annotation.Transactional;
import com.wangtian.modules.sys.entity.SysUserEntity;
import java.util.Map;
......@@ -11,10 +13,16 @@ import java.util.Map;
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-16 08:23:26
* @date 2023-07-16 17:09:57
*/
public interface InvestmentPlanService extends IService<InvestmentPlanEntity> {
PageUtils queryPage(Map<String, Object> params);
@Transactional
void saveInvestmentPlan(InvestmentPlanEntity investmentPlanEntity, SysUserEntity loginUser);
@Transactional
void updateInvestmentPlanById(InvestmentPlanEntity investmentPlanEntity, SysUserEntity loginUser);
}
......@@ -3,19 +3,28 @@ package com.wangtian.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sitech.idworkstarter.IdWorkService;
import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.Query;
import com.wangtian.modules.manage.dao.InvestmentPlanDao;
import com.wangtian.modules.manage.entity.InvestmentPlanEntity;
import com.wangtian.modules.manage.service.InvestmentPlanService;
import com.wangtian.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
@Service("investmentPlanService")
public class InvestmentPlanServiceImpl extends ServiceImpl<InvestmentPlanDao, InvestmentPlanEntity> implements InvestmentPlanService {
@Autowired
IdWorkService idWorkService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<InvestmentPlanEntity> page = this.page(
......@@ -26,4 +35,22 @@ public class InvestmentPlanServiceImpl extends ServiceImpl<InvestmentPlanDao, In
return new PageUtils(page);
}
@Override
public void updateInvestmentPlanById(InvestmentPlanEntity investmentPlanEntity, SysUserEntity loginUser) {
investmentPlanEntity.setUpdateTime(new Date());
investmentPlanEntity.setUpdateUserName(loginUser.getUsername());
investmentPlanEntity.setUpdateUserId(loginUser.getUserId());
baseMapper.updateById(investmentPlanEntity);
}
@Override
public void saveInvestmentPlan(InvestmentPlanEntity investmentPlanEntity, SysUserEntity loginUser) {
investmentPlanEntity.setId(idWorkService.getSEQByKey("id_seq"));
investmentPlanEntity.setCreateUserId(loginUser.getUserId());
investmentPlanEntity.setCreateUserName(loginUser.getUsername());
investmentPlanEntity.setCreateTime(new Date());
baseMapper.insert(investmentPlanEntity);
}
}
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