作者:计算机源码社
个人简介:本人七年开发经验,擅长Java、微信小程序、Python、Android等,大家有这一块的问题可以一起交流!
学习资料、程序开发、技术解答、代码讲解、文档报告
1、绪论
1.1 项目背景
随着社会经济的发展越来越快,如今越来越多的物资管理系统犹如雨后般的春笋一样竞争激烈,传统的物资管理是通过借助笔和纸等工具,来对物资来进行记录、管理。这样对物资进行管理的风险显而易见,首先面临的一个问题就是不易储存,由于数据的增长,储存变得越来越吃力,一旦由于管理员的疏忽,就很容易导致出现医疗物资的管理变得尤为不易,排查错误会十分的费力、费时。所以,随着我们社会的经济发展,计算机已经渗透到各行各业中,研发一个对物资的管理系统,对企业或者其他相关机构来说非常重要,能够方便、简洁的解决数据存储以及操作、排查困难的问题。
2、核心功能模块
基于SpringBoot+Vue疫情物资管理系统采用B/S的结构,Java语言进行设计,后台上采用Mysql数据库。
基于SpringBoot+Vue疫情物资管理系统的主要使用者分为管理员和用户,实现功能包括:
①用户:注册、登录、查看公告信息、查看物资详情、分类搜索、个人信息管理、物资申领等功能。
②管理员:登录、个人信息管理、用户管理、公告信息管理、物资信息管理、物资入库管理、物资出库管理、入库统计、出库统计等功能。
3、项目页面展示
4、 核心代码
**
* 物资入库
* 后端接口
*/
@RestController
@RequestMapping("/wuziruku")
public class WuzirukuController {
@Autowired
private WuzirukuService wuzirukuService;
/**
* 后端 物资入库列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map params,WuzirukuEntity wuziruku,
HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = wuzirukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wuziruku), params), params));
return R.ok().put("data", page);
}
/**
* 前端 物资入库列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map params,WuzirukuEntity wuziruku,
HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = wuzirukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wuziruku), params), params));
return R.ok().put("data", page);
}
/**
* 物资入库列表
*/
@RequestMapping("/lists")
public R list( WuzirukuEntity wuziruku){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( wuziruku, "wuziruku"));
return R.ok().put("data", wuzirukuService.selectListView(ew));
}
/**
* 查询 物资入库
*/
@RequestMapping("/query")
public R query(WuzirukuEntity wuziruku){
EntityWrapper< WuzirukuEntity> ew = new EntityWrapper< WuzirukuEntity>();
ew.allEq(MPUtil.allEQMapPre( wuziruku, "wuziruku"));
WuzirukuView wuzirukuView = wuzirukuService.selectView(ew);
return R.ok("查询物资入库成功").put("data", wuzirukuView);
}
/**
* 后端 物资入库详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
WuzirukuEntity wuziruku = wuzirukuService.selectById(id);
return R.ok().put("data", wuziruku);
}
/**
* 前端 物资入库详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
WuzirukuEntity wuziruku = wuzirukuService.selectById(id);
return R.ok().put("data", wuziruku);
}
/**
* 后端保存 物资入库
*/
@RequestMapping("/save")
public R save(@RequestBody WuzirukuEntity wuziruku, HttpServletRequest request){
wuziruku.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wuziruku);
wuzirukuService.insert(wuziruku);
return R.ok();
}
/**
* 前端保存 物资入库
*/
@RequestMapping("/add")
public R add(@RequestBody WuzirukuEntity wuziruku, HttpServletRequest request){
wuziruku.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wuziruku);
wuzirukuService.insert(wuziruku);
return R.ok();
}
/**
* 修改 物资入库
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody WuzirukuEntity wuziruku, HttpServletRequest request){
//ValidatorUtils.validateEntity(wuziruku);
wuzirukuService.updateById(wuziruku);//全部更新
return R.ok();
}
/**
* 删除 物资入库
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
wuzirukuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 物资入库提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper wrapper = new EntityWrapper();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = wuzirukuService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 物资申领
* 后端接口
*/
@RestController
@RequestMapping("/wuzishenling")
public class WuzishenlingController {
@Autowired
private WuzishenlingService wuzishenlingService;
/**
* 后端物资申领列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map params,WuzishenlingEntity wuzishenling,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date shenlingriqistart,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date shenlingriqiend,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wuzishenling.setYonghuming((String)request.getSession().getAttribute("username"));
}
EntityWrapper ew = new EntityWrapper();
if(shenlingriqistart!=null) ew.ge("shenlingriqi", shenlingriqistart);
if(shenlingriqiend!=null) ew.le("shenlingriqi", shenlingriqiend);
PageUtils page = wuzishenlingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wuzishenling), params), params));
return R.ok().put("data", page);
}
/**
* 前端物资申领列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map params,WuzishenlingEntity wuzishenling,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date shenlingriqistart,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date shenlingriqiend,
HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
if(shenlingriqistart!=null) ew.ge("shenlingriqi", shenlingriqistart);
if(shenlingriqiend!=null) ew.le("shenlingriqi", shenlingriqiend);
PageUtils page = wuzishenlingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wuzishenling), params), params));
return R.ok().put("data", page);
}
/**
* 物资申领列表
*/
@RequestMapping("/lists")
public R list( WuzishenlingEntity wuzishenling){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( wuzishenling, "wuzishenling"));
return R.ok().put("data", wuzishenlingService.selectListView(ew));
}
/**
* 查询物资申领
*/
@RequestMapping("/query")
public R query(WuzishenlingEntity wuzishenling){
EntityWrapper< WuzishenlingEntity> ew = new EntityWrapper< WuzishenlingEntity>();
ew.allEq(MPUtil.allEQMapPre( wuzishenling, "wuzishenling"));
WuzishenlingView wuzishenlingView = wuzishenlingService.selectView(ew);
return R.ok("查询物资申领成功").put("data", wuzishenlingView);
}
/**
* 后端物资申领详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
WuzishenlingEntity wuzishenling = wuzishenlingService.selectById(id);
return R.ok().put("data", wuzishenling);
}
/**
* 前端物资申领详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
WuzishenlingEntity wuzishenling = wuzishenlingService.selectById(id);
return R.ok().put("data", wuzishenling);
}
/**
* 后端保存物资申领
*/
@RequestMapping("/save")
public R save(@RequestBody WuzishenlingEntity wuzishenling, HttpServletRequest request){
wuzishenling.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wuzishenling);
wuzishenlingService.insert(wuzishenling);
return R.ok();
}
/**
* 前端保存物资申领
*/
@RequestMapping("/add")
public R add(@RequestBody WuzishenlingEntity wuzishenling, HttpServletRequest request){
wuzishenling.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wuzishenling);
wuzishenlingService.insert(wuzishenling);
return R.ok();
}
/**
* 修改物资申领
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody WuzishenlingEntity wuzishenling, HttpServletRequest request){
//ValidatorUtils.validateEntity(wuzishenling);
wuzishenlingService.updateById(wuzishenling);//全部更新
return R.ok();
}
/**
* 删除物资申领
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
wuzishenlingService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 物资申领提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper wrapper = new EntityWrapper();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wrapper.eq("yonghuming", (String)request.getSession().getAttribute("username"));
}
int count = wuzishenlingService.selectCount(wrapper);
return R.ok().put("count", count);
}