基于Java的手工艺品销售系统设计与实现【源码+文档+PPT】

精彩专栏推荐订阅:在下方主页👇🏻👇🏻👇🏻👇🏻

💖🔥作者主页计算机毕设木哥🔥 💖

一、项目介绍

计算机网络发展到现在已经好几十年了,在理论上面已经有了很丰富的基础,并且在现实生活中也到处都在使用,可以说,经过几十年的发展,互联网技术已经把地域信息的隔阂给消除了,让整个世界都可以即时通话和联系,极大的方便了人们的生活。所以说,手工艺品销售系统用计算机技术来进行设计,不仅在管理方面更加的系统化,操作性强,最重要的是关于数据的保存和使用都能节约大量的时间,该系统非常的好用。
手工艺品销售系统管理数据的工具是MySQL,编码的语言是Java,运用的框架是Spring Boot框架。该系统可以实现手工艺品管理,手工艺品评价管理,手工艺品订单管理,购物车管理,手工艺品求购管理,商家管理等功能。
手工艺品销售系统不仅能让操作人员使用更加地方便,并且设计的也很合理,能有效的避免误操作,让数据在录入的环节就符合设计需要,极大的规避了源头性的输入误差,顺利的让数据变得更加可控并且可靠,让出错的几率降到最低。

二、开发环境

  • 开发语言:Java
  • 数据库:MySQL
  • 系统架构:B/S
  • 后端:springboot
  • 前端:vue
  • 工具:IDEA或者Eclipse、JDK1.8、Maven

三、系统展示

登录模块:
在这里插入图片描述

首页模块:
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

管理模块展示:

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

四、代码展示

@RestController
@Controller
@RequestMapping("/cailiao")
public class CailiaoController {
    private static final Logger logger = LoggerFactory.getLogger(CailiaoController.class);

    @Autowired
    private CailiaoService cailiaoService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service

    @Autowired
    private YonghuService yonghuService;
    @Autowired
    private WeixiuyuanService weixiuyuanService;


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("员工".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        else if("维修员".equals(role))
            params.put("weixiuyuanId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = cailiaoService.queryPage(params);

        //字典表数据转换
        List<CailiaoView> list =(List<CailiaoView>)page.getList();
        for(CailiaoView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        CailiaoEntity cailiao = cailiaoService.selectById(id);
        if(cailiao !=null){
            //entity转view
            CailiaoView view = new CailiaoView();
            BeanUtils.copyProperties( cailiao , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody CailiaoEntity cailiao, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,cailiao:{}",this.getClass().getName(),cailiao.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");

        Wrapper<CailiaoEntity> queryWrapper = new EntityWrapper<CailiaoEntity>()
            .eq("cailiao_uuid_unmber", cailiao.getCailiaoUuidUnmber())
            .eq("cailiao_name", cailiao.getCailiaoName())
            .eq("cailiao_types", cailiao.getCailiaoTypes())
            .eq("cailiao_kucun_number", cailiao.getCailiaoKucunNumber())
            .eq("cailiao_danwei", cailiao.getCailiaoDanwei())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CailiaoEntity cailiaoEntity = cailiaoService.selectOne(queryWrapper);
        if(cailiaoEntity==null){
            cailiao.setCreateTime(new Date());
            cailiaoService.insert(cailiao);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody CailiaoEntity cailiao, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,cailiao:{}",this.getClass().getName(),cailiao.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(StringUtil.isEmpty(role))
//            return R.error(511,"权限为空");
        //根据字段查询是否有相同数据
        Wrapper<CailiaoEntity> queryWrapper = new EntityWrapper<CailiaoEntity>()
            .notIn("id",cailiao.getId())
            .andNew()
            .eq("cailiao_uuid_unmber", cailiao.getCailiaoUuidUnmber())
            .eq("cailiao_name", cailiao.getCailiaoName())
            .eq("cailiao_types", cailiao.getCailiaoTypes())
            .eq("cailiao_kucun_number", cailiao.getCailiaoKucunNumber())
            .eq("cailiao_danwei", cailiao.getCailiaoDanwei())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CailiaoEntity cailiaoEntity = cailiaoService.selectOne(queryWrapper);
        if(cailiaoEntity==null){
            cailiaoService.updateById(cailiao);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        cailiaoService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<CailiaoEntity> cailiaoList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            CailiaoEntity cailiaoEntity = new CailiaoEntity();
//                            cailiaoEntity.setCailiaoUuidUnmber(data.get(0));                    //材料编号 要改的
//                            cailiaoEntity.setCailiaoName(data.get(0));                    //材料名称 要改的
//                            cailiaoEntity.setCailiaoTypes(Integer.valueOf(data.get(0)));   //材料类型 要改的
//                            cailiaoEntity.setCailiaoKucunNumber(Integer.valueOf(data.get(0)));   //材料数量 要改的
//                            cailiaoEntity.setCailiaoDanwei(data.get(0));                    //单位 要改的
//                            cailiaoEntity.setCreateTime(date);//时间
                            cailiaoList.add(cailiaoEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        cailiaoService.insertBatch(cailiaoList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }

五、项目文档展示

在这里插入图片描述

大家可以帮忙点赞、收藏、关注、评论啦 👇🏻

  • 28
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值