基于springboot特产销售平台源码和论文

“互联网+”的战略实施后,很多行业的信息化水平都有了很大的提升。但是目前很多藏区特产销售信息仍是通过人工管理的方式进行,需要在各个岗位投入大量的人力进行很多重复性工作,使得对人力物力造成诸多浪费,工作效率不高等情况;同时为后续的工作带来了隐患。并且现有的藏区特产销售平台由于用户的体验感较差、系统流程不完善导致系统的使用率较低。此藏区特产销售平台的部署与应用,将对特产信息管理、特产分类管理、特产分类管理、特产评分管理、系统管理、订单管理等业务进行管理,这可以简化藏区特产销售管理工作程序、降低劳动成本、提高业务效率和工作效率。为了有效推动藏区特产销售管理资源的合理配置和使用,适应现代藏区特产销售管理机构的管理办法,迫切需要研发一套更加全面的藏区特产销售平台

本课题在充分研究了SpringBoot框架基础上,采用B/S模式,以Java为开发语言,MyEclipse为开发工具,MySQL为数据管理平台,实现的内容主要包括首页、个人中心、用户管理、特产信息管理、特产分类管理、特产分类管理、特产评分管理、系统管理、订单管理等功能。

关键词藏区特产销售平台Java;互联网+

基于springboot特产销售平台源码和论文375

演示视频:

基于springboot特产销售平台源码和论文

Abstract

After the implementation of the "Internet plus" strategy, the informatization level of many industries has been greatly improved. However, at present, a lot of sales information of Tibetan specialties is still carried out by manual management, which requires a lot of manpower to be invested in various posts for a lot of repetitive work, resulting in a lot of waste of human and material resources and low work efficiency. At the same time for the follow-up work brought hidden trouble. In addition, the existing Tibetan specialty sales platform has a low utilization rate due to poor user experience and imperfect system process. The deployment and application of the Tibetan specialty sales platform will manage the specialty information management, specialty classification management, specialty classification management, specialty scoring management, system management, order management and other businesses, which can simplify the Tibetan specialty sales management work procedures, reduce labor costs, improve business efficiency and work efficiency. In order to effectively promote the rational allocation and use of Tibetan specialty sales management resources and adapt to the management methods of modern Tibetan specialty sales management organizations, it is urgent to develop a more comprehensive Tibetan specialty sales platform.

This topic is based on the full study of SpringBoot framework, using B/S mode, Java as the development language, MyEclipse as the development tool, MySQL as the data management platform, The main contents include home page, personal center, user management, specialty information management, specialty classification management, specialty classification management, specialty scoring management, system management, order management and other functions.

Key words: Tibetan specialty sales platform; Java; Internet +

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.AddressEntity;
import com.entity.view.AddressView;

import com.service.AddressService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;

/**
 * 地址
 * 后端接口
 * @author 
 * @email 
 * @date 2022-04-06 15:28:34
 */
@RestController
@RequestMapping("/address")
public class AddressController {
    @Autowired
    private AddressService addressService;


    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,AddressEntity address,
		HttpServletRequest request){
    	if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		address.setUserid((Long)request.getSession().getAttribute("userId"));
    	}
        EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
		PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,AddressEntity address, 
		HttpServletRequest request){
    	if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		address.setUserid((Long)request.getSession().getAttribute("userId"));
    	}
        EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
		PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( AddressEntity address){
       	EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
      	ew.allEq(MPUtil.allEQMapPre( address, "address")); 
        return R.ok().put("data", addressService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(AddressEntity address){
        EntityWrapper< AddressEntity> ew = new EntityWrapper< AddressEntity>();
 		ew.allEq(MPUtil.allEQMapPre( address, "address")); 
		AddressView addressView =  addressService.selectView(ew);
		return R.ok("查询地址成功").put("data", addressView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        AddressEntity address = addressService.selectById(id);
        return R.ok().put("data", address);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        AddressEntity address = addressService.selectById(id);
        return R.ok().put("data", address);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody AddressEntity address, HttpServletRequest request){
    	address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(address);
    	address.setUserid((Long)request.getSession().getAttribute("userId"));
		Long userId = (Long)request.getSession().getAttribute("userId");
    	if(address.getIsdefault().equals("是")) {
    		addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));
    	}
    	address.setUserid(userId);
        addressService.insert(address);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody AddressEntity address, HttpServletRequest request){
    	address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(address);
    	address.setUserid((Long)request.getSession().getAttribute("userId"));
		Long userId = (Long)request.getSession().getAttribute("userId");
    	if(address.getIsdefault().equals("是")) {
    		addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));
    	}
    	address.setUserid(userId);
        addressService.insert(address);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody AddressEntity address, HttpServletRequest request){
        //ValidatorUtils.validateEntity(address);
        if(address.getIsdefault().equals("是")) {
    		addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", request.getSession().getAttribute("userId")));
    	}
        addressService.updateById(address);//全部更新
        return R.ok();
    }
    
    /**
     * 获取默认地址
     */
    @RequestMapping("/default")
    public R defaultAddress(HttpServletRequest request){
    	Wrapper<AddressEntity> wrapper = new EntityWrapper<AddressEntity>().eq("isdefault", "是").eq("userid", request.getSession().getAttribute("userId"));
        AddressEntity address = addressService.selectOne(wrapper);
        return R.ok().put("data", address);
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        addressService.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<String, Object> 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<AddressEntity> wrapper = new EntityWrapper<AddressEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}
		if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    		wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));
    	}


		int count = addressService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	







}

 


package com.controller;

import com.alibaba.fastjson.JSONObject;
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.ZhuanjiaEntity;
import com.entity.view.ZhuanjiaView;
import com.service.DictionaryService;
import com.service.HuiyuanService;
import com.service.TokenService;
import com.service.ZhuanjiaService;
import com.utils.PageUtils;
import com.utils.PoiUtil;
import com.utils.R;
import com.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 医生
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/zhuanjia")
public class ZhuanjiaController {
    private static final Logger logger = LoggerFactory.getLogger(ZhuanjiaController.class);

    @Autowired
    private ZhuanjiaService zhuanjiaService;


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

    //级联表service

    @Autowired
    private HuiyuanService huiyuanService;


    /**
    * 后端列表
    */
    @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(false)
            return R.error(511,"永不会进入");
        else if("用户 show2 photoShow".equals(role))
            params.put("huiyuanId",request.getSession().getAttribute("userId"));
        else if("医生".equals(role))
            params.put("zhuanjiaId",request.getSession().getAttribute("userId"));
        params.put("zhuanjiaDeleteStart",1);params.put("zhuanjiaDeleteEnd",1);
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = zhuanjiaService.queryPage(params);

        //字典表数据转换
        List<ZhuanjiaView> list =(List<ZhuanjiaView>)page.getList();
        for(ZhuanjiaView 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);
        ZhuanjiaEntity zhuanjia = zhuanjiaService.selectById(id);
        if(zhuanjia !=null){
            //entity转view
            ZhuanjiaView view = new ZhuanjiaView();
            BeanUtils.copyProperties( zhuanjia , view );//把实体数据重构到view中

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

    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>()
            .eq("username", zhuanjia.getUsername())
            .or()
            .eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone())
            .or()
            .eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber())
            .andNew()
            .eq("zhuanjia_delete", 1)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);
        if(zhuanjiaEntity==null){
            zhuanjia.setZhuanjiaDelete(1);
            zhuanjia.setInsertTime(new Date());
            zhuanjia.setCreateTime(new Date());
            zhuanjia.setPassword("123456");
            zhuanjiaService.insert(zhuanjia);
            return R.ok();
        }else {
            return R.error(511,"账户或者医生手机号或者医生身份证号已经被使用");
        }
    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        //根据字段查询是否有相同数据
        Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>()
            .notIn("id",zhuanjia.getId())
            .andNew()
            .eq("username", zhuanjia.getUsername())
            .or()
            .eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone())
            .or()
            .eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber())
            .andNew()
            .eq("zhuanjia_delete", 1)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);
        if("".equals(zhuanjia.getZhuanjiaPhoto()) || "null".equals(zhuanjia.getZhuanjiaPhoto())){
                zhuanjia.setZhuanjiaPhoto(null);
        }
        if(zhuanjiaEntity==null){
            zhuanjiaService.updateById(zhuanjia);//根据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());
        ArrayList<ZhuanjiaEntity> list = new ArrayList<>();
        for(Integer id:ids){
            ZhuanjiaEntity zhuanjiaEntity = new ZhuanjiaEntity();
            zhuanjiaEntity.setId(id);
            zhuanjiaEntity.setZhuanjiaDelete(2);
            list.add(zhuanjiaEntity);
        }
        if(list != null && list.size() >0){
            zhuanjiaService.updateBatchById(list);
        }
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save(String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            List<ZhuanjiaEntity> zhuanjiaList = 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){
                            //循环
                            ZhuanjiaEntity zhuanjiaEntity = new ZhuanjiaEntity();
//                            zhuanjiaEntity.setUsername(data.get(0));                    //账户 要改的
//                            //zhuanjiaEntity.setPassword("123456");//密码
//                            zhuanjiaEntity.setZhuanjiaName(data.get(0));                    //医生姓名 要改的
//                            zhuanjiaEntity.setZhuanjiaPhone(data.get(0));                    //医生手机号 要改的
//                            zhuanjiaEntity.setZhuanjiaIdNumber(data.get(0));                    //医生身份证号 要改的
//                            zhuanjiaEntity.setZhuanjiaPhoto("");//详情和图片
//                            zhuanjiaEntity.setSexTypes(Integer.valueOf(data.get(0)));   //性别 要改的
//                            zhuanjiaEntity.setKeshiTypes(Integer.valueOf(data.get(0)));   //科室 要改的
//                            zhuanjiaEntity.setZhiweiTypes(Integer.valueOf(data.get(0)));   //职位 要改的
//                            zhuanjiaEntity.setGuahaoMoney(data.get(0));                    //挂号费 要改的
//                            zhuanjiaEntity.setZhuanjiaEmail(data.get(0));                    //电子邮箱 要改的
//                            zhuanjiaEntity.setZhuanjiaContent("");//详情和图片
//                            zhuanjiaEntity.setZhuanjiaDelete(1);//逻辑删除字段
//                            zhuanjiaEntity.setInsertTime(date);//时间
//                            zhuanjiaEntity.setCreateTime(date);//时间
//                            zhuanjiaEntity.setZhuanjiaPaiban(data.get(0));                    //医生排班 要改的
                            zhuanjiaList.add(zhuanjiaEntity);


                            //把要查询是否重复的字段放入map中
                                //账户
                                if(seachFields.containsKey("username")){
                                    List<String> username = seachFields.get("username");
                                    username.add(data.get(0));//要改的
                                }else{
                                    List<String> username = new ArrayList<>();
                                    username.add(data.get(0));//要改的
                                    seachFields.put("username",username);
                                }
                                //医生手机号
                                if(seachFields.containsKey("zhuanjiaPhone")){
                                    List<String> zhuanjiaPhone = seachFields.get("zhuanjiaPhone");
                                    zhuanjiaPhone.add(data.get(0));//要改的
                                }else{
                                    List<String> zhuanjiaPhone = new ArrayList<>();
                                    zhuanjiaPhone.add(data.get(0));//要改的
                                    seachFields.put("zhuanjiaPhone",zhuanjiaPhone);
                                }
                                //医生身份证号
                                if(seachFields.containsKey("zhuanjiaIdNumber")){
                                    List<String> zhuanjiaIdNumber = seachFields.get("zhuanjiaIdNumber");
                                    zhuanjiaIdNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> zhuanjiaIdNumber = new ArrayList<>();
                                    zhuanjiaIdNumber.add(data.get(0));//要改的
                                    seachFields.put("zhuanjiaIdNumber",zhuanjiaIdNumber);
                                }
                        }

                        //查询是否重复
                         //账户
                        List<ZhuanjiaEntity> zhuanjiaEntities_username = zhuanjiaService.selectList(new EntityWrapper<ZhuanjiaEntity>().in("username", seachFields.get("username")).eq("zhuanjia_delete", 1));
                        if(zhuanjiaEntities_username.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(ZhuanjiaEntity s:zhuanjiaEntities_username){
                                repeatFields.add(s.getUsername());
                            }
                            return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                         //医生手机号
                        List<ZhuanjiaEntity> zhuanjiaEntities_zhuanjiaPhone = zhuanjiaService.selectList(new EntityWrapper<ZhuanjiaEntity>().in("zhuanjia_phone", seachFields.get("zhuanjiaPhone")).eq("zhuanjia_delete", 1));
                        if(zhuanjiaEntities_zhuanjiaPhone.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(ZhuanjiaEntity s:zhuanjiaEntities_zhuanjiaPhone){
                                repeatFields.add(s.getZhuanjiaPhone());
                            }
                            return R.error(511,"数据库的该表中的 [医生手机号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                         //医生身份证号
                        List<ZhuanjiaEntity> zhuanjiaEntities_zhuanjiaIdNumber = zhuanjiaService.selectList(new EntityWrapper<ZhuanjiaEntity>().in("zhuanjia_id_number", seachFields.get("zhuanjiaIdNumber")).eq("zhuanjia_delete", 1));
                        if(zhuanjiaEntities_zhuanjiaIdNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(ZhuanjiaEntity s:zhuanjiaEntities_zhuanjiaIdNumber){
                                repeatFields.add(s.getZhuanjiaIdNumber());
                            }
                            return R.error(511,"数据库的该表中的 [医生身份证号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        zhuanjiaService.insertBatch(zhuanjiaList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }


    /**
    * 登录
    */
    @IgnoreAuth
    @RequestMapping(value = "/login")
    public R login(String username, String password, String captcha, HttpServletRequest request) {
        ZhuanjiaEntity zhuanjia = zhuanjiaService.selectOne(new EntityWrapper<ZhuanjiaEntity>().eq("username", username));
        if(zhuanjia==null || !zhuanjia.getPassword().equals(password))
            return R.error("账号或密码不正确");
        else if(zhuanjia.getZhuanjiaDelete() != 1)
            return R.error("账户已被删除");
        //  // 获取监听器中的字典表
        // ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
        // Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
        // Map<Integer, String> role_types = dictionaryMap.get("role_types");
        // role_types.get(.getRoleTypes());
        String token = tokenService.generateToken(zhuanjia.getId(),username, "zhuanjia", "医生");
        R r = R.ok();
        r.put("token", token);
        r.put("role","医生");
        r.put("username",zhuanjia.getZhuanjiaName());
        r.put("tableName","zhuanjia");
        r.put("userId",zhuanjia.getId());
        return r;
    }

    /**
    * 注册
    */
    @IgnoreAuth
    @PostMapping(value = "/register")
    public R register(@RequestBody ZhuanjiaEntity zhuanjia){
//    	ValidatorUtils.validateEntity(user);
        Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>()
            .eq("username", zhuanjia.getUsername())
            .or()
            .eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone())
            .or()
            .eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber())
            .andNew()
            .eq("zhuanjia_delete", 1)
            ;
        ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);
        if(zhuanjiaEntity != null)
            return R.error("账户或者医生手机号或者医生身份证号已经被使用");
        zhuanjia.setGuahaoMoney(0.0);
        zhuanjia.setZhuanjiaDelete(1);
        zhuanjia.setInsertTime(new Date());
        zhuanjia.setCreateTime(new Date());
        zhuanjiaService.insert(zhuanjia);
        return R.ok();
    }

    /**
     * 重置密码
     */
    @GetMapping(value = "/resetPassword")
    public R resetPassword(Integer  id){
        ZhuanjiaEntity zhuanjia = new ZhuanjiaEntity();
        zhuanjia.setPassword("123456");
        zhuanjia.setId(id);
        zhuanjia.setInsertTime(new Date());
        zhuanjiaService.updateById(zhuanjia);
        return R.ok();
    }


    /**
     * 忘记密码
     */
    @IgnoreAuth
    @RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request) {
        ZhuanjiaEntity zhuanjia = zhuanjiaService.selectOne(new EntityWrapper<ZhuanjiaEntity>().eq("username", username));
        if(zhuanjia!=null){
            zhuanjia.setPassword("123456");
            boolean b = zhuanjiaService.updateById(zhuanjia);
            if(!b){
               return R.error();
            }
        }else{
           return R.error("账号不存在");
        }
        return R.ok();
    }


    /**
    * 获取用户的session用户信息
    */
    @RequestMapping("/session")
    public R getCurrZhuanjia(HttpServletRequest request){
        Integer id = (Integer)request.getSession().getAttribute("userId");
        ZhuanjiaEntity zhuanjia = zhuanjiaService.selectById(id);
        if(zhuanjia !=null){
            //entity转view
            ZhuanjiaView view = new ZhuanjiaView();
            BeanUtils.copyProperties( zhuanjia , view );//把实体数据重构到view中

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


    /**
    * 退出
    */
    @GetMapping(value = "logout")
    public R logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return R.ok("退出成功");
    }




    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = zhuanjiaService.queryPage(params);

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

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ZhuanjiaEntity zhuanjia = zhuanjiaService.selectById(id);
            if(zhuanjia !=null){


                //entity转view
                ZhuanjiaView view = new ZhuanjiaView();
                BeanUtils.copyProperties( zhuanjia , view );//把实体数据重构到view中

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


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody ZhuanjiaEntity zhuanjia, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,zhuanjia:{}",this.getClass().getName(),zhuanjia.toString());
        Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>()
            .eq("username", zhuanjia.getUsername())
            .or()
            .eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone())
            .or()
            .eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber())
            .andNew()
            .eq("zhuanjia_delete", 1)
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);
        if(zhuanjiaEntity==null){
            zhuanjia.setZhuanjiaDelete(1);
            zhuanjia.setInsertTime(new Date());
            zhuanjia.setCreateTime(new Date());
        zhuanjia.setPassword("123456");
        zhuanjiaService.insert(zhuanjia);
            return R.ok();
        }else {
            return R.error(511,"账户或者医生手机号或者医生身份证号已经被使用");
        }
    }


}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/391454.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【初始RabbitMQ】工作队列的实现

工作队列 工作队列&#xff08;又称为任务队列&#xff09;的主要思想是避免立即执行资源密集型任务&#xff0c;而不得不等待它完成。 相反我们安排任务在之后执行。我们把任务封装为消息并将其发送到队列。在后台运行的工作进 程将弹出任务并最终执行作业。当有多个工作线程…

电脑屏幕录制工具 Top10 榜单,免费无水印方法集

随着媒体行业的突飞猛进&#xff0c;不同服务之间对有效屏幕录制的竞争日益激烈。这导致市场上出现了质量参差不齐的屏幕录像机。特别是有些录屏器会自动给你录制的视频加上水印&#xff0c;给需要在公共场合使用的人留下不专业的印象。除此之外&#xff0c;它们甚至不能保护您…

【Google Bard】免费生成图像——功能和使用方法详解

Google Bard 关于Bard 图片生成功能打开Bard通过Bard来生成图片Bard Vs Bing Vs Dall-EBard的生成结果Bing的生成结果Dall-E 的生成结果 总结 关于Bard 图片生成功能 Google在2月1日&#xff08;当地时间&#xff09;宣布&#xff0c;其对话型AI“Bard”新增了图像生成功能。 …

Mysql——update更新数据的方式

注&#xff1a;文章参考&#xff1a; MySQL 更新数据 不同条件(批量)更新不同值_update批量更新同一列不同值-CSDN博客文章浏览阅读2w次&#xff0c;点赞20次&#xff0c;收藏70次。一般在更新时会遇到以下场景&#xff1a;1.全部更新&#xff1b;2.根据条件更新字段中的某部分…

MATLAB离线文档安装

MATLAB离线文档安装 来源于最全matlab安装离线文档教程只是对内容进行了精简&#xff0c;同时更方便查找 一、下载离线文档 我上传的2023b离线文档 提供本体属于违规行为&#xff0c;本体下载链接已删除 为方便已安装好软件的朋友想安装离线帮助文档&#xff0c;由于官网下载…

模型 IPO(输入、处理、输出)学习模型

系列文章 分享 模型&#xff0c;了解更多&#x1f449; 模型_总纲目录。重在提升认知。信息转化与传递。 1 模型 IPO(输入、处理、输出)学习模型的应用 1.1 项目管理知识体系 PMBOK 中的IPO应用 在项目管理领域&#xff0c;PMBOK&#xff08;Project Management Body of Know…

究极小白如何自己搭建一个自动发卡网站-独角数卡

本人从来没接触过建站&#xff0c;我之前都是在TB上花90叫别人给我搭建的网站&#xff0c;前几天这个TB店倒闭跑路了&#xff0c;而我的发卡网也打不开了&#xff0c;没办法&#xff0c;逼上梁山&#xff0c;自己捣鼓出来了&#xff01;下面是2023/4/2自己建好的&#xff01; …

STM32F1 - 系统时钟SysTick

SysTick 1> SysTick硬件框图2> SysTick的时钟源3> 1ms定时_中断方式4> 思考&#xff1a;无符号数 0 - 255 ?相关资料 1> SysTick硬件框图 SysTick属于Cotex-M3&#xff0c;是CPU外设&#xff1b; SysTick: 位宽24bit&#xff0c; 递减计数&#xff0c;自动重装…

《Go 简易速速上手小册》第2章:控制结构与函数(2024 最新版)

文章目录 2.1 条件语句&#xff1a;决策的艺术2.1.1 基础知识讲解2.1.2 重点案例&#xff1a;用户角色权限判断实现用户角色权限判断扩展功能实现代码功能扩展&#xff1a;添加或删除用户 2.1.3 拓展案例 1&#xff1a;成绩等级判断实现成绩等级判断功能实现代码扩展功能&#…

【开源图床】使用Typora+PicGo+Github+CDN搭建个人博客图床

准备工作&#xff1a; 首先电脑得提前完成安装如下&#xff1a; 1. nodejs环境(node ,npm):【安装指南】nodejs下载、安装与配置详细教程 2. Picgo:【安装指南】图床神器之Picgo下载、安装与配置详细教程 3. Typora:【安装指南】markdown神器之Typora下载、安装与无限使用详细教…

canal监听binlog记录业务数据的变更;canalAdmin对instance做web配置

概述 平时在开发中会通过logback打印一些开发日志&#xff0c;有时也会需要记录一些业务日志&#xff0c;简单的就直接用log记录一下&#xff0c;但是系统中需要记录日志的地方越来越多时&#xff0c;不能每个地方都写一套log记录&#xff1b; 由于平常用的大多都是mysql&…

Linux进程间通信(三)-----System V消息队列

消息队列的概念及原理 消息队列实际上就是在系统当中创建了一个队列&#xff0c;队列当中的每个成员都是一个数据块&#xff0c;这些数据块都由类型和信息两部分构成&#xff0c;两个互相通信的进程通过某种方式看到同一个消息队列&#xff0c;这两个进程向对方发数据时&#x…

【C++ QT项目2】——高仿安信可串口调试助手

【C QT项目2】——高仿安信可串口调试助手 1. 项目概述2. 项目UI设计3. 串口通信核心代码开发3.1 QSerialPort介绍及示例3.2 扫描系统串口3.3 数据的收发3.4 定时发送&#xff08;QT定时器&#xff09;3.5 HEX显示与发送 4. 串口调试助手功能的优化4.1 串口的实时扫描4.2 获取系…

2024.2.15 模拟实现 RabbitMQ —— 消息持久化

目录 引言 约定存储方式 消息序列化 重点理解 针对 MessageFileManager 单元测试 小结 统一硬盘操作​​​​​​​ 引言 问题&#xff1a; 关于 Message&#xff08;消息&#xff09;为啥在硬盘上存储&#xff1f; 回答&#xff1a; 消息操作并不涉及到复杂的增删查改消…

对比@Resource和@Autowired

版权声明 本文原创作者&#xff1a;谷哥的小弟作者博客地址&#xff1a;http://blog.csdn.net/lfdfhl Resource和Autowired概述 在Java的Spring框架中&#xff0c;Resource和Autowired都是用于实现依赖注入&#xff08;Dependency Injection, DI&#xff09;的重要注解。依赖…

【机器学习笔记】11 支持向量机

支 持 向 量 机 &#xff08; Support Vector Machine,SVM &#xff09; 支 持 向 量 机 是 一 类 按 监 督 学 习 &#xff08; supervisedlearning&#xff09;方式对数据进行二元分类的广义线性分类器&#xff08;generalized linear classifier&#xff09;&#xff0c;其…

Python教程(26)——Python迭代器和生成器详解

迭代器 Python中的迭代器是一种对象&#xff0c;它可以迭代&#xff08;遍历&#xff09;一个可迭代对象&#xff08;比如列表、元组或字符串&#xff09;的元素。迭代器用于实现迭代器协议&#xff0c;即包含 __iter__() 方法和 __next__() 方法。 迭代器的工作原理是每次调…

大模型- 检索增强七宗罪

前言 地址&#xff1a;https://arxiv.org/pdf/2401.05856.pdf 标题&#xff1a;Seven Failure Points When Engineering a Retrieval Augmented Generation System 这篇论文介绍了如何设计一个检索增强生成系统&#xff08;RAG&#xff09;&#xff0c;作者通过对三个不同领域…

人工智能专题:通过AI转变保险(英译中)

今天分享的是人工智能系列深度研究报告&#xff1a;《人工智能专题&#xff1a;通过AI转变保险&#xff08;英译中&#xff09;》。 &#xff08;报告出品方&#xff1a;VIEWPOINT&#xff09; 在新时代释放数据的力量 在数据和人工智能 &#xff08; AI &#xff09; 融合的…

Mac配置Python3最简单的方法

此文介绍Mac用Anaconda配置Python3 达成效果 能让你目前只装有Python2的Mac装上Python3&#xff0c;同时拥有很多科学计算库 anaconda介绍 anaconda 是一个python的发行版&#xff0c;包括了python和很多常见的软件库, 和一个包管理器conda。常见的科学计算类的库都包含在里…