commit b1f24cedc241b733f03237b841b0188944913ea0 Author: wjl <3533384953@qq.com> Date: Mon Apr 28 23:50:17 2025 +0800 Initial commit diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..7d05e99 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# 依赖于环境的 Maven 主目录路径 +/mavenHomeManager.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f03c948 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..122a905 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/com/controller/CommonController.java b/com/controller/CommonController.java new file mode 100644 index 0000000..61ed655 --- /dev/null +++ b/com/controller/CommonController.java @@ -0,0 +1,240 @@ +package com.controller; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.entity.ConfigEntity; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +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.annotation.IgnoreAuth; +import com.baidu.aip.face.AipFace; +import com.baidu.aip.face.MatchRequest; +import com.baidu.aip.util.Base64Util; +import com.service.CommonService; +import com.service.ConfigService; +import com.utils.BaiduUtil; +import com.utils.FileUtil; +import com.utils.R; + +/** + * 通用接口 + */ +@RestController +public class CommonController{ + @Autowired + private CommonService commonService; + + @Autowired + private ConfigService configService; + + private static AipFace client = null; + + private static String BAIDU_DITU_AK = null; + + @RequestMapping("/location") + public R location(String lng,String lat) { + if(BAIDU_DITU_AK==null) { + BAIDU_DITU_AK = configService.selectOne(new EntityWrapper().eq("name", "baidu_ditu_ak")).getValue(); + if(BAIDU_DITU_AK==null) { + return R.error("请在配置管理中正确配置baidu_ditu_ak"); + } + } + Map map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat); + return R.ok().put("data", map); + } + + /** + * 人脸比对 + * + * @param face1 人脸1 + * @param face2 人脸2 + * @return + */ + @RequestMapping("/matchFace") + public R matchFace(String face1, String face2, HttpServletRequest request) { + if(client==null) { + /*String AppID = configService.selectOne(new EntityWrapper().eq("name", "AppID")).getValue();*/ + String APIKey = configService.selectOne(new EntityWrapper().eq("name", "APIKey")).getValue(); + String SecretKey = configService.selectOne(new EntityWrapper().eq("name", "SecretKey")).getValue(); + String token = BaiduUtil.getAuth(APIKey, SecretKey); + if(token==null) { + return R.error("请在配置管理中正确配置APIKey和SecretKey"); + } + client = new AipFace(null, APIKey, SecretKey); + client.setConnectionTimeoutInMillis(2000); + client.setSocketTimeoutInMillis(60000); + } + JSONObject res = null; + try { + File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1); + File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2); + String img1 = Base64Util.encode(FileUtil.FileToByte(file1)); + String img2 = Base64Util.encode(FileUtil.FileToByte(file2)); + MatchRequest req1 = new MatchRequest(img1, "BASE64"); + MatchRequest req2 = new MatchRequest(img2, "BASE64"); + ArrayList requests = new ArrayList(); + requests.add(req1); + requests.add(req2); + res = client.match(requests); + System.out.println(res.get("result")); + } catch (FileNotFoundException e) { + e.printStackTrace(); + return R.error("文件不存在"); + } catch (IOException e) { + e.printStackTrace(); + } + return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString())); + } + + /** + * 获取table表中的column列表(联动接口) + * @param table + * @param column + * @return + */ + @RequestMapping("/option/{tableName}/{columnName}") + @IgnoreAuth + public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) { + Map params = new HashMap(); + params.put("table", tableName); + params.put("column", columnName); + if(StringUtils.isNotBlank(level)) { + params.put("level", level); + } + if(StringUtils.isNotBlank(parent)) { + params.put("parent", parent); + } + List data = commonService.getOption(params); + return R.ok().put("data", data); + } + + /** + * 根据table中的column获取单条记录 + * @param table + * @param column + * @return + */ + @RequestMapping("/follow/{tableName}/{columnName}") + @IgnoreAuth + public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) { + Map params = new HashMap(); + params.put("table", tableName); + params.put("column", columnName); + params.put("columnValue", columnValue); + Map result = commonService.getFollowByOption(params); + return R.ok().put("data", result); + } + + /** + * 修改table表的sfsh状态 + * @param table + * @param map + * @return + */ + @RequestMapping("/sh/{tableName}") + public R sh(@PathVariable("tableName") String tableName, @RequestBody Map map) { + map.put("table", tableName); + commonService.sh(map); + return R.ok(); + } + + /** + * 获取需要提醒的记录数 + * @param tableName + * @param columnName + * @param type 1:数字 2:日期 + * @param map + * @return + */ + @RequestMapping("/remind/{tableName}/{columnName}/{type}") + @IgnoreAuth + public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, + @PathVariable("type") String type,@RequestParam Map map) { + map.put("table", tableName); + 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)); + } + } + + int count = commonService.remindCount(map); + return R.ok().put("count", count); + } + + /** + * 单列求和 + */ + @RequestMapping("/cal/{tableName}/{columnName}") + @IgnoreAuth + public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) { + Map params = new HashMap(); + params.put("table", tableName); + params.put("column", columnName); + Map result = commonService.selectCal(params); + return R.ok().put("data", result); + } + + /** + * 分组统计 + */ + @RequestMapping("/group/{tableName}/{columnName}") + @IgnoreAuth + public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) { + Map params = new HashMap(); + params.put("table", tableName); + params.put("column", columnName); + List> result = commonService.selectGroup(params); + return R.ok().put("data", result); + } + + /** + * (按值统计) + */ + @RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}") + @IgnoreAuth + public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) { + Map params = new HashMap(); + params.put("table", tableName); + params.put("xColumn", xColumnName); + params.put("yColumn", yColumnName); + List> result = commonService.selectValue(params); + return R.ok().put("data", result); + } + +} diff --git a/com/controller/ConfigController.java b/com/controller/ConfigController.java new file mode 100644 index 0000000..ec724c4 --- /dev/null +++ b/com/controller/ConfigController.java @@ -0,0 +1,110 @@ + +package com.controller; + + +import java.util.Arrays; +import java.util.Map; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.entity.ConfigEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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.annotation.IgnoreAuth; +import com.service.ConfigService; +import com.utils.PageUtils; +import com.utils.R; + +/** + * 登录相关 + */ +@RequestMapping("config") +@RestController +public class ConfigController{ + + @Autowired + private ConfigService configService; + + /** + * 列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params,ConfigEntity config){ + EntityWrapper ew = new EntityWrapper(); + PageUtils page = configService.queryPage(params); + return R.ok().put("data", page); + } + + /** + * 列表 + */ + @IgnoreAuth + @RequestMapping("/list") + public R list(@RequestParam Map params,ConfigEntity config){ + EntityWrapper ew = new EntityWrapper(); + PageUtils page = configService.queryPage(params); + return R.ok().put("data", page); + } + + /** + * 信息 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") String id){ + ConfigEntity config = configService.selectById(id); + return R.ok().put("data", config); + } + + /** + * 详情 + */ + @IgnoreAuth + @RequestMapping("/detail/{id}") + public R detail(@PathVariable("id") String id){ + ConfigEntity config = configService.selectById(id); + return R.ok().put("data", config); + } + + /** + * 根据name获取信息 + */ + @RequestMapping("/info") + public R infoByName(@RequestParam String name){ + ConfigEntity config = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); + return R.ok().put("data", config); + } + + /** + * 保存 + */ + @PostMapping("/save") + public R save(@RequestBody ConfigEntity config){ +// ValidatorUtils.validateEntity(config); + configService.insert(config); + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody ConfigEntity config){ +// ValidatorUtils.validateEntity(config); + configService.updateById(config);//全部更新 + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Long[] ids){ + configService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } +} diff --git a/com/controller/DaiquController.java b/com/controller/DaiquController.java new file mode 100644 index 0000000..07cb1a8 --- /dev/null +++ b/com/controller/DaiquController.java @@ -0,0 +1,244 @@ +package com.controller; + + +import java.text.SimpleDateFormat; +import com.alibaba.fastjson.JSONObject; +import java.util.*; + +import com.entity.JiedanEntity; +import com.service.*; +import org.springframework.beans.BeanUtils; +import javax.servlet.http.HttpServletRequest; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.utils.StringUtil; +import java.lang.reflect.InvocationTargetException; + +import org.apache.commons.lang3.StringUtils; +import com.annotation.IgnoreAuth; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; + +import com.entity.DaiquEntity; + +import com.entity.view.DaiquView; +import com.entity.YonghuEntity; +import com.entity.ZhandianEntity; +import com.utils.PageUtils; +import com.utils.R; + +/** + * 待取件表 + * 后端接口 + * @author + * @email + * @date 2021-03-11 +*/ +@RestController +@Controller +@RequestMapping("/daiqu") +public class DaiquController { + private static final Logger logger = LoggerFactory.getLogger(DaiquController.class); + + @Autowired + private DaiquService daiquService; + + @Autowired + private JiedanService jiedanService; + + @Autowired + private TokenService tokenService; + @Autowired + private DictionaryService dictionaryService; + + + //级联表service + @Autowired + private YonghuService yonghuService; + @Autowired + private ZhandianService zhandianService; + + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, HttpServletRequest request){ + logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); + String role = String.valueOf(request.getSession().getAttribute("role")); + if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ + params.put("yonghuId",request.getSession().getAttribute("userId")); + } + PageUtils page = daiquService.queryPage(params); + + //字典表数据转换 + List list =(List)page.getList(); + for(DaiquView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } + return R.ok().put("data", page); + } + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + DaiquEntity daiqu = daiquService.selectById(id); + if(daiqu !=null){ + //entity转view + DaiquView view = new DaiquView(); + BeanUtils.copyProperties( daiqu , view );//把实体数据重构到view中 + + //级联表 + YonghuEntity yonghu = yonghuService.selectById(daiqu.getYonghuId()); + if(yonghu != null){ + BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 + view.setYonghuId(yonghu.getId()); + } + //级联表 + ZhandianEntity zhandian = zhandianService.selectById(daiqu.getZhandianId()); + if(zhandian != null){ + BeanUtils.copyProperties( zhandian , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 + view.setZhandianId(zhandian.getId()); + } + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } + + } + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody DaiquEntity daiqu, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,daiqu:{}",this.getClass().getName(),daiqu.toString()); + daiqu.setKdztTypes(1); + daiqu.setTakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6)); + Wrapper queryWrapper = new EntityWrapper() + .eq("dqname", daiqu.getDqname()) + .eq("zhandian_id", daiqu.getZhandianId()) + .eq("yonghu_id", daiqu.getYonghuId()) + .eq("takecode", daiqu.getTakecode()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + DaiquEntity daiquEntity = daiquService.selectOne(queryWrapper); + if(daiquEntity==null){ + daiquService.insert(daiqu); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody DaiquEntity daiqu, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,daiqu:{}",this.getClass().getName(),daiqu.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",daiqu.getId()) + .eq("dqname", daiqu.getDqname()) + .eq("zhandian_id", daiqu.getZhandianId()) + .eq("yonghu_id", daiqu.getYonghuId()) + .eq("kddx_types", daiqu.getKddxTypes()) + .eq("dqphone", daiqu.getDqphone()) + .eq("takecode", daiqu.getTakecode()) + .eq("kdzt_types", daiqu.getKdztTypes()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + DaiquEntity daiquEntity = daiquService.selectOne(queryWrapper); + daiqu.setPickupTime(new Date()); + if(daiquEntity==null){ + daiquService.updateById(daiqu);//根据id更新 + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + + /** + * 代取订单 + */ + @RequestMapping("/replaceExpress") + public R replaceExpress(@RequestBody Integer ids){ + DaiquEntity daiqu = daiquService.selectById(ids); + if(daiqu == null){ + return R.error("数据不存在"); + } + YonghuEntity yonghu = yonghuService.selectById(daiqu.getYonghuId()); + if(yonghu == null){ + return R.error("数据不存在"); + } + JiedanEntity jiedan = new JiedanEntity(); + jiedan.setInitiateTime(new Date()); + jiedan.setJdyonghuId(daiqu.getYonghuId()); + jiedan.setJdphone(daiqu.getDqphone()); + jiedan.setAddresseename(yonghu.getName()); + jiedan.setJdaddressee("住宿楼栋:"+yonghu.getDormitory()+" ,寝室号:"+yonghu.getDormitory()); + jiedan.setJdtakecode(daiqu.getTakecode()); + jiedan.setDaiqukuaidimc(daiqu.getDqname()); + jiedan.setJdztTypes(1);//1未接 + jiedan.setKdlxTypes(1);//1取件 + jiedan.setOdd(String.valueOf(new Date().getTime())); + Wrapper queryWrapper = new EntityWrapper() + .eq("jdyonghu_id", jiedan.getJdyonghuId()) + .eq("jdtakecode", jiedan.getJdtakecode()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); + if(jiedanEntity==null){ + daiqu.setKdztTypes(3); + daiquService.updateById(daiqu); + jiedanService.insert(jiedan); + return R.ok(); + }else { + return R.error(511,"你已经发布过这件快递的代取订单了"); + } + } + + + /** + * 取件 + */ + @RequestMapping("/pickUp") + public R pickUp(@RequestBody Integer ids){ + DaiquEntity daiqu = daiquService.selectById(ids); + if(daiqu == null){ + return R.error("数据不存在"); + } + daiqu.setKdztTypes(2); + daiqu.setPickupTime(new Date()); + daiquService.updateById(daiqu); + return R.ok(); + } + + + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Integer[] ids){ + logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); + daiquService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + +} + diff --git a/com/controller/DaiqurenController.java b/com/controller/DaiqurenController.java new file mode 100644 index 0000000..40f29a5 --- /dev/null +++ b/com/controller/DaiqurenController.java @@ -0,0 +1,225 @@ +package com.controller; + + +import java.text.SimpleDateFormat; +import com.alibaba.fastjson.JSONObject; +import java.util.*; + +import com.entity.DaiqurenEntity; +import org.springframework.beans.BeanUtils; +import javax.servlet.http.HttpServletRequest; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; +import com.service.TokenService; +import com.utils.StringUtil; +import java.lang.reflect.InvocationTargetException; + +import com.service.DictionaryService; +import org.apache.commons.lang3.StringUtils; +import com.annotation.IgnoreAuth; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; + +import com.entity.DaiqurenEntity; + +import com.service.DaiqurenService; +import com.entity.view.DaiqurenView; +import com.utils.PageUtils; +import com.utils.R; + +/** + * + * 后端接口 + * @author + * @email + * @date 2021-03-11 +*/ +@RestController +@Controller +@RequestMapping("/daiquren") +public class DaiqurenController { + private static final Logger logger = LoggerFactory.getLogger(DaiqurenController.class); + + @Autowired + private DaiqurenService daiqurenService; + + + @Autowired + private TokenService tokenService; + @Autowired + private DictionaryService dictionaryService; + + + //级联表service + + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, HttpServletRequest request){ + logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); + String role = String.valueOf(request.getSession().getAttribute("role")); + if(StringUtil.isNotEmpty(role) && "代取人".equals(role)){ + params.put("yonghuId",request.getSession().getAttribute("userId")); + } + PageUtils page = daiqurenService.queryPage(params); + + //字典表数据转换 + List list =(List)page.getList(); + for(DaiqurenView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } + return R.ok().put("data", page); + } + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + DaiqurenEntity daiquren = daiqurenService.selectById(id); + if(daiquren !=null){ + //entity转view + DaiqurenView view = new DaiqurenView(); + BeanUtils.copyProperties( daiquren , view );//把实体数据重构到view中 + + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } + + } + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody DaiqurenEntity daiquren, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,daiquren:{}",this.getClass().getName(),daiquren.toString()); + Wrapper queryWrapper = new EntityWrapper() + .eq("name", daiquren.getName()) + .eq("username", daiquren.getUsername()) + .eq("password", daiquren.getPassword()) + .eq("sex_types", daiquren.getSexTypes()) + .eq("phone", daiquren.getPhone()) + .eq("role", daiquren.getRole()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + DaiqurenEntity daiqurenEntity = daiqurenService.selectOne(queryWrapper); + if(daiqurenEntity==null){ + daiquren.setRole("代取人"); + daiqurenService.insert(daiquren); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody DaiqurenEntity daiquren, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,daiquren:{}",this.getClass().getName(),daiquren.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",daiquren.getId()) + .eq("name", daiquren.getName()) + .eq("username", daiquren.getUsername()) + .eq("password", daiquren.getPassword()) + .eq("sex_types", daiquren.getSexTypes()) + .eq("phone", daiquren.getPhone()) + .eq("role", daiquren.getRole()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + DaiqurenEntity daiqurenEntity = daiqurenService.selectOne(queryWrapper); + if("".equals(daiquren.getImgPhoto()) || "null".equals(daiquren.getImgPhoto())){ + daiquren.setImgPhoto(null); + } + if(daiqurenEntity==null){ + daiqurenService.updateById(daiquren);//根据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()); + daiqurenService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + + /** + * 登录 + */ + @IgnoreAuth + @PostMapping(value = "/login") + public R login(String username, String password, String role, HttpServletRequest request) { + DaiqurenEntity yonghu = daiqurenService.selectOne(new EntityWrapper().eq("username", username)); + if(yonghu==null || !yonghu.getPassword().equals(password)) { + return R.error("账号或密码不正确"); + } + if(!role.equals(yonghu.getRole())){ + return R.error("权限不正确"); + } + String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "代取人"); + R r = R.ok(); + r.put("token", token); + r.put("role","代取人"); + r.put("userId",yonghu.getId()); + return r; + } + + /** + * 注册 + */ + @IgnoreAuth + @PostMapping(value = "/register") + public R register(@RequestBody DaiqurenEntity yonghu){ + // ValidatorUtils.validateEntity(user); + if(daiqurenService.selectOne(new EntityWrapper().eq("username", yonghu.getUsername()).orNew().eq("phone",yonghu.getPhone())) !=null) { + return R.error("代取人已存在或手机号身份证号已经被使用"); + } + daiqurenService.insert(yonghu); + return R.ok(); + } + + /** + * 获取代取人的session代取人信息 + */ + @RequestMapping("/session") + public R getCurrYonghu(HttpServletRequest request){ + Integer id = (Integer)request.getSession().getAttribute("userId"); + DaiqurenEntity yonghu = daiqurenService.selectById(id); + return R.ok().put("data", yonghu); + } + + + /** + * 退出 + */ + @GetMapping(value = "logout") + public R logout(HttpServletRequest request) { + request.getSession().invalidate(); + return R.ok("退出成功"); + } + + +} + diff --git a/com/controller/DictionaryController.java b/com/controller/DictionaryController.java new file mode 100644 index 0000000..e3a01ae --- /dev/null +++ b/com/controller/DictionaryController.java @@ -0,0 +1,188 @@ +package com.controller; + + +import java.text.SimpleDateFormat; +import com.alibaba.fastjson.JSONObject; +import java.util.*; +import org.springframework.beans.BeanUtils; +import javax.servlet.http.HttpServletRequest; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; +import com.service.TokenService; +import com.utils.StringUtil; +import java.lang.reflect.InvocationTargetException; + +import com.service.DictionaryService; +import org.apache.commons.lang3.StringUtils; +import com.annotation.IgnoreAuth; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; + +import com.entity.DictionaryEntity; + +import com.service.DictionaryService; +import com.entity.view.DictionaryView; +import com.utils.PageUtils; +import com.utils.R; + +/** + * 字典表 + * 后端接口 + * @author + * @email + * @date 2021-03-11 +*/ +@RestController +@Controller +@RequestMapping("/dictionary") +public class DictionaryController { + private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class); + + @Autowired + private DictionaryService dictionaryService; + + + @Autowired + private TokenService tokenService; + + + //级联表service + + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, HttpServletRequest request){ + logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); + String role = String.valueOf(request.getSession().getAttribute("role")); + if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ + params.put("yonghuId",request.getSession().getAttribute("userId")); + } + PageUtils page = dictionaryService.queryPage(params); + + //字典表数据转换 + List list =(List)page.getList(); + for(DictionaryView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } + return R.ok().put("data", page); + } + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + DictionaryEntity dictionary = dictionaryService.selectById(id); + if(dictionary !=null){ + //entity转view + DictionaryView view = new DictionaryView(); + BeanUtils.copyProperties( dictionary , view );//把实体数据重构到view中 + + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } + + } + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString()); + Wrapper queryWrapper = new EntityWrapper() + .eq("dic_code", dictionary.getDicCode()) + .eq("code_index", dictionary.getCodeIndex()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper); + if(dictionaryEntity==null){ + dictionary.setCreateTime(new Date()); + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // dictionary.set + // } + dictionaryService.insert(dictionary); + //如果字典表新增数据的话,把数据再重新查出,放入监听器中 + List dictionaryEntities = dictionaryService.selectList(new EntityWrapper()); + ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); + Map> map = new HashMap<>(); + for(DictionaryEntity d :dictionaryEntities){ + Map m = map.get(d.getDicCode()); + if(m ==null || m.isEmpty()){ + m = new HashMap<>(); + } + m.put(d.getCodeIndex(),d.getIndexName()); + map.put(d.getDicCode(),m); + } + servletContext.setAttribute("dictionaryMap",map); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",dictionary.getId()) + .eq("dic_code", dictionary.getDicCode()) + .eq("code_index", dictionary.getCodeIndex()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper); + if(dictionaryEntity==null){ + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // dictionary.set + // } + dictionaryService.updateById(dictionary);//根据id更新 + //如果字典表修改数据的话,把数据再重新查出,放入监听器中 + List dictionaryEntities = dictionaryService.selectList(new EntityWrapper()); + ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); + Map> map = new HashMap<>(); + for(DictionaryEntity d :dictionaryEntities){ + Map m = map.get(d.getDicCode()); + if(m ==null || m.isEmpty()){ + m = new HashMap<>(); + } + m.put(d.getCodeIndex(),d.getIndexName()); + map.put(d.getDicCode(),m); + } + servletContext.setAttribute("dictionaryMap",map); + 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()); + dictionaryService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + +} + diff --git a/com/controller/FileController.java b/com/controller/FileController.java new file mode 100644 index 0000000..0c32b96 --- /dev/null +++ b/com/controller/FileController.java @@ -0,0 +1,83 @@ +package com.controller; + +import java.io.File; +import java.io.IOException; +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.entity.ConfigEntity; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import com.annotation.IgnoreAuth; +import com.entity.EIException; +import com.service.ConfigService; +import com.utils.R; + +/** + * 上传文件映射表 + */ +@RestController +@RequestMapping("file") +@SuppressWarnings({"unchecked","rawtypes"}) +public class FileController{ + @Autowired + private ConfigService configService; + /** + * 上传文件 + */ + @RequestMapping("/upload") + public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception { + if (file.isEmpty()) { + throw new EIException("上传文件不能为空"); + } + String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); + String fileName = new Date().getTime()+"."+fileExt; + File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName); + file.transferTo(dest); + if(StringUtils.isNotBlank(type) && type.equals("1")) { + ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); + if(configEntity==null) { + configEntity = new ConfigEntity(); + configEntity.setName("faceFile"); + configEntity.setValue(fileName); + } else { + configEntity.setValue(fileName); + } + configService.insertOrUpdate(configEntity); + } + return R.ok().put("file", fileName); + } + + /** + * 下载文件 + */ + @IgnoreAuth + @RequestMapping("/download") + public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) { + try { + File file = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName); + if (file.exists()) { + response.reset(); + response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\""); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Access-Control-Allow-Credentials", "true"); + response.setContentType("application/octet-stream; charset=UTF-8"); + IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream()); + } + + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/com/controller/JiedanController.java b/com/controller/JiedanController.java new file mode 100644 index 0000000..2f327f3 --- /dev/null +++ b/com/controller/JiedanController.java @@ -0,0 +1,259 @@ +package com.controller; + + +import java.text.SimpleDateFormat; +import com.alibaba.fastjson.JSONObject; +import java.util.*; + +import com.entity.DaiqurenEntity; +import com.entity.YijiedanEntity; +import com.entity.YonghuEntity; +import com.service.*; +import org.springframework.beans.BeanUtils; +import javax.servlet.http.HttpServletRequest; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.utils.StringUtil; +import java.lang.reflect.InvocationTargetException; + +import org.apache.commons.lang3.StringUtils; +import com.annotation.IgnoreAuth; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; + +import com.entity.JiedanEntity; + +import com.entity.view.JiedanView; +import com.utils.PageUtils; +import com.utils.R; + +/** + * 快递接单表 + * 后端接口 + * @author + * @email + * @date 2021-03-11 +*/ +@RestController +@Controller +@RequestMapping("/jiedan") +public class JiedanController { + private static final Logger logger = LoggerFactory.getLogger(JiedanController.class); + + @Autowired + private YijiedanService yijiedanService; + + @Autowired + private JiedanService jiedanService; + + @Autowired + private DaiqurenService daiqurenService; + + @Autowired + private YonghuService yonghuService; + + @Autowired + private DictionaryService dictionaryService; + + + //级联表service + + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, HttpServletRequest request){ + logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); + String role = String.valueOf(request.getSession().getAttribute("role")); + PageUtils page = null; + if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ + params.put("yonghuId",request.getSession().getAttribute("userId")); + page = jiedanService.queryPage(params); + } + page = jiedanService.queryPage(params); + //字典表数据转换 + List list =(List)page.getList(); + for(JiedanView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } + return R.ok().put("data", page); + } + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + JiedanEntity jiedan = jiedanService.selectById(id); + if(jiedan !=null){ + //entity转view + JiedanView view = new JiedanView(); + BeanUtils.copyProperties( jiedan , view );//把实体数据重构到view中 + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } + + } + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody JiedanEntity jiedan, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,jiedan:{}",this.getClass().getName(),jiedan.toString()); + Wrapper queryWrapper = new EntityWrapper() + .eq("addresseename", jiedan.getAddresseename()) + .eq("jdphone", jiedan.getJdphone()) + .eq("jdaddressee", jiedan.getJdaddressee()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); + if(jiedanEntity==null){ + jiedanService.insert(jiedan); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody JiedanEntity jiedan, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,jiedan:{}",this.getClass().getName(),jiedan.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",jiedan.getId()) + .eq("odd", jiedan.getOdd()) + .eq("daiqukuaidimc", jiedan.getDaiqukuaidimc()) + .eq("jdyonghu_id", jiedan.getJdyonghuId()) + .eq("addresseename", jiedan.getAddresseename()) + .eq("jdphone", jiedan.getJdphone()) + .eq("jdaddressee", jiedan.getJdaddressee()) + .eq("jdtakecode", jiedan.getJdtakecode()) + .eq("jdzt_types", jiedan.getJdztTypes()) + .eq("kdlx_types", jiedan.getKdlxTypes()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); + jiedan.setInitiateTime(new Date()); + if(jiedanEntity==null){ + jiedanService.updateById(jiedan);//根据id更新 + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + + + /** + * 接单 + */ + @RequestMapping("/receiving") + public R receiving(@RequestBody Integer ids, HttpServletRequest request){ + JiedanEntity jiedan = jiedanService.selectById(ids); + if(jiedan == null){ + return R.error(); + } + if(request.getSession().getAttribute("role").equals("代取人")){ + DaiqurenEntity userId = daiqurenService.selectById((Integer) request.getSession().getAttribute("userId")); + + jiedan.setJdztTypes(2);//以接 + YijiedanEntity yijiedan = new YijiedanEntity(); + yijiedan.setOdd(jiedan.getOdd()); + yijiedan.setYonghuId(jiedan.getJdyonghuId()); + yijiedan.setFbphone(jiedan.getJdphone()); + yijiedan.setDaiqurenId(userId.getId()); + yijiedan.setJdphone(userId.getPhone()); + yijiedan.setInitiateTime(new Date()); + yijiedan.setDdztTypes(1);//1正在路上 + + Wrapper queryWrapper = new EntityWrapper() + .eq("odd", yijiedan.getOdd()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper); + if(yijiedanEntity==null){ + jiedanService.updateById(jiedan); + yijiedanService.insert(yijiedan); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + return R.error("***"); + } + + + /** + * 删除 + */ + @RequestMapping("/ship") + public R ship(String name, Integer yh, Integer dx, HttpServletRequest request){ + if(name == null && name == "null" && name == ""){ + return R.error("快递名称不能为空"); + } + if(yh == null && yh == 0){ + return R.error("收件人不能为空"); + } + + YonghuEntity yonghu = yonghuService.selectById(yh); + if(yonghu == null){ + return R.error(); + } + if(yonghu.getId() == (Integer)request.getSession().getAttribute("userId")){ + return R.error("发件人和收件人不能相同"); + } + JiedanEntity jiedan = new JiedanEntity(); + jiedan.setOdd(String.valueOf(new Date().getTime())); + jiedan.setDaiqukuaidimc(name); + jiedan.setDx(dx); + jiedan.setJdyonghuId((Integer)request.getSession().getAttribute("userId")); + jiedan.setJdphone(yonghu.getPhone()); + jiedan.setInitiateTime(new Date()); + jiedan.setAddresseename(yonghu.getName()); + jiedan.setJdaddressee("住宿楼栋:"+yonghu.getDormitory()+" ,寝室号:"+yonghu.getDormitory()); + jiedan.setJdtakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6)); + jiedan.setJdztTypes(1);//1未接 + jiedan.setKdlxTypes(2);//2寄件 + Wrapper queryWrapper = new EntityWrapper() + .eq("addresseename", jiedan.getAddresseename()) + .eq("jdphone", jiedan.getJdphone()) + .eq("jdaddressee", jiedan.getJdaddressee()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); + if(jiedanEntity==null){ + jiedanService.insert(jiedan); + 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()); + jiedanService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + +} + diff --git a/com/controller/UserController.java b/com/controller/UserController.java new file mode 100644 index 0000000..51ff5db --- /dev/null +++ b/com/controller/UserController.java @@ -0,0 +1,178 @@ + +package com.controller; + + +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import com.annotation.IgnoreAuth; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.entity.TokenEntity; +import com.entity.UserEntity; +import com.service.TokenService; +import com.service.UserService; +import com.utils.CommonUtil; +import com.utils.MPUtil; +import com.utils.PageUtils; +import com.utils.R; +import com.utils.ValidatorUtils; + +/** + * 登录相关 + */ +@RequestMapping("users") +@RestController +public class UserController{ + + @Autowired + private UserService userService; + + @Autowired + private TokenService tokenService; + + /** + * 登录 + */ + @IgnoreAuth + @PostMapping(value = "/login") + public R login(String username, String password, String role, HttpServletRequest request) { + UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); + if(user != null){ + if(!user.getRole().equals(role)){ + return R.error("权限不正常"); + } + if(user==null || !user.getPassword().equals(password)) { + return R.error("账号或密码不正确"); + } + String token = tokenService.generateToken(user.getId(),username, "users", user.getRole()); + return R.ok().put("token", token); + }else{ + return R.error("账号或密码或权限不对"); + } + + } + + /** + * 注册 + */ + @IgnoreAuth + @PostMapping(value = "/register") + public R register(@RequestBody UserEntity user){ +// ValidatorUtils.validateEntity(user); + if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { + return R.error("用户已存在"); + } + userService.insert(user); + return R.ok(); + } + + /** + * 退出 + */ + @GetMapping(value = "logout") + public R logout(HttpServletRequest request) { + request.getSession().invalidate(); + return R.ok("退出成功"); + } + + /** + * 密码重置 + */ + @IgnoreAuth + @RequestMapping(value = "/resetPass") + public R resetPass(String username, HttpServletRequest request){ + UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); + if(user==null) { + return R.error("账号不存在"); + } + user.setPassword("123456"); + userService.update(user,null); + return R.ok("密码已重置为:123456"); + } + + /** + * 列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params,UserEntity user){ + EntityWrapper ew = new EntityWrapper(); + PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); + return R.ok().put("data", page); + } + + /** + * 列表 + */ + @RequestMapping("/list") + public R list( UserEntity user){ + EntityWrapper ew = new EntityWrapper(); + ew.allEq(MPUtil.allEQMapPre( user, "user")); + return R.ok().put("data", userService.selectListView(ew)); + } + + /** + * 信息 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") String id){ + UserEntity user = userService.selectById(id); + return R.ok().put("data", user); + } + + /** + * 获取用户的session用户信息 + */ + @RequestMapping("/session") + public R getCurrUser(HttpServletRequest request){ + Integer id = (Integer)request.getSession().getAttribute("userId"); + UserEntity user = userService.selectById(id); + return R.ok().put("data", user); + } + + /** + * 保存 + */ + @PostMapping("/save") + public R save(@RequestBody UserEntity user){ +// ValidatorUtils.validateEntity(user); + if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { + return R.error("用户已存在"); + } + userService.insert(user); + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody UserEntity user){ +// ValidatorUtils.validateEntity(user); + userService.updateById(user);//全部更新 + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Integer[] ids){ + userService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } +} diff --git a/com/controller/YijiedanController.java b/com/controller/YijiedanController.java new file mode 100644 index 0000000..4d11efe --- /dev/null +++ b/com/controller/YijiedanController.java @@ -0,0 +1,246 @@ +package com.controller; + + +import java.text.SimpleDateFormat; +import com.alibaba.fastjson.JSONObject; +import java.util.*; + +import com.entity.*; +import com.service.*; +import org.springframework.beans.BeanUtils; +import javax.servlet.http.HttpServletRequest; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.utils.StringUtil; +import java.lang.reflect.InvocationTargetException; + +import org.apache.commons.lang3.StringUtils; +import com.annotation.IgnoreAuth; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; + +import com.entity.view.YijiedanView; +import com.utils.PageUtils; +import com.utils.R; + +/** + * 已接单表 + * 后端接口 + * @author + * @email + * @date 2021-03-11 +*/ +@RestController +@Controller +@RequestMapping("/yijiedan") +public class YijiedanController { + private static final Logger logger = LoggerFactory.getLogger(YijiedanController.class); + + @Autowired + private YijiedanService yijiedanService; + + @Autowired + private JiedanService jiedanService; + + @Autowired + private DictionaryService dictionaryService; + + @Autowired + private DaiquService daiquService; + + //级联表service + @Autowired + private DaiqurenService daiqurenService; + + @Autowired + private YonghuService yonghuService; + + + @Autowired + private ZhandianService zhandianService; + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, HttpServletRequest request){ + logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); + String role = String.valueOf(request.getSession().getAttribute("role")); + PageUtils page = null; + if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ + params.put("yonghuId",request.getSession().getAttribute("userId")); + page = yijiedanService.queryPage(params); + }else if(StringUtil.isNotEmpty(role) && "代取人".equals(role)){ + params.put("daiqurenId",request.getSession().getAttribute("userId")); + page = yijiedanService.queryPage(params); + } + page = yijiedanService.queryPage(params); + + //字典表数据转换 + List list =(List)page.getList(); + for(YijiedanView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } + return R.ok().put("data", page); + } + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + YijiedanEntity yijiedan = yijiedanService.selectById(id); + if(yijiedan !=null){ + //entity转view + YijiedanView view = new YijiedanView(); + BeanUtils.copyProperties( yijiedan , view );//把实体数据重构到view中 + + //级联表 + DaiqurenEntity daiquren = daiqurenService.selectById(yijiedan.getDaiqurenId()); + if(daiquren != null){ + view.setDaiqurenId(daiquren.getId()); + view.setYhname(daiquren.getName()); + } + //级联表 + YonghuEntity yonghu = yonghuService.selectById(yijiedan.getYonghuId()); + if(yonghu != null){ + BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 + view.setYonghuId(yonghu.getId()); + } + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } + + } + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody YijiedanEntity yijiedan, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,yijiedan:{}",this.getClass().getName(),yijiedan.toString()); + Wrapper queryWrapper = new EntityWrapper() + .eq("odd", yijiedan.getOdd()) + .eq("yonghu_id", yijiedan.getYonghuId()) + .eq("fbphone", yijiedan.getFbphone()) + .eq("daiquren_id", yijiedan.getDaiqurenId()) + .eq("jdphone", yijiedan.getJdphone()) + .eq("ddzt_types", yijiedan.getDdztTypes()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper); + if(yijiedanEntity==null){ + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // yijiedan.set + // } + yijiedanService.insert(yijiedan); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody YijiedanEntity yijiedan, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,yijiedan:{}",this.getClass().getName(),yijiedan.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",yijiedan.getId()) + .eq("odd", yijiedan.getOdd()) + .eq("yonghu_id", yijiedan.getYonghuId()) + .eq("fbphone", yijiedan.getFbphone()) + .eq("daiquren_id", yijiedan.getDaiqurenId()) + .eq("jdphone", yijiedan.getJdphone()) + .eq("ddzt_types", yijiedan.getDdztTypes()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper); + yijiedan.setInitiateTime(new Date()); + if(yijiedanEntity==null){ + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // yijiedan.set + // } + yijiedanService.updateById(yijiedan);//根据id更新 + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + + /** + * 完成 + */ + @RequestMapping("/accomplish") + public R accomplish(@RequestBody Integer ids){ + YijiedanEntity yijiedan = yijiedanService.selectById(ids); + if(yijiedan == null){ + return R.error(); + } + JiedanEntity odd = jiedanService.selectOne(new EntityWrapper().eq("odd", yijiedan.getOdd())); + if(odd == null){ + return R.error(); + } + if(odd.getKdlxTypes() == 1){ + DaiquEntity takecode = daiquService.selectOne(new EntityWrapper().eq("takecode", odd.getJdtakecode())); + if(takecode == null){ + return R.error(); + } + takecode.setKdztTypes(2); + + takecode.setPickupTime(new Date()); + daiquService.updateById(takecode); + }else{ + DaiquEntity daiqu = new DaiquEntity(); + List zhandian = zhandianService.selectList(null); + int max=zhandian.size()-1,min=0; + int ran2 = (int) (Math.random()*(max-min)+min); + //随机站点 + daiqu.setZhandianId(zhandian.get(ran2).getId()); + //快递名称 + daiqu.setDqname(odd.getDaiqukuaidimc()); + //快递大小 + daiqu.setKddxTypes(odd.getDx()); + daiqu.setKdztTypes(1); + //收件用户id + YonghuEntity name = yonghuService.selectOne(new EntityWrapper().eq("name", odd.getAddresseename())); + daiqu.setYonghuId(name.getId()); + //手机号 + daiqu.setDqphone(name.getPhone()); + //取件码 + daiqu.setTakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6)); + daiquService.insert(daiqu); + } + yijiedan.setDdztTypes(2);//2已完成 + yijiedanService.updateById(yijiedan); + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Integer[] ids){ + logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); + yijiedanService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + +} + diff --git a/com/controller/YonghuController.java b/com/controller/YonghuController.java new file mode 100644 index 0000000..5511dec --- /dev/null +++ b/com/controller/YonghuController.java @@ -0,0 +1,242 @@ +package com.controller; + + +import java.text.SimpleDateFormat; +import com.alibaba.fastjson.JSONObject; +import java.util.*; +import org.springframework.beans.BeanUtils; +import javax.servlet.http.HttpServletRequest; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; +import com.service.TokenService; +import com.utils.StringUtil; +import java.lang.reflect.InvocationTargetException; + +import com.service.DictionaryService; +import org.apache.commons.lang3.StringUtils; +import com.annotation.IgnoreAuth; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; + +import com.entity.YonghuEntity; + +import com.service.YonghuService; +import com.entity.view.YonghuView; +import com.utils.PageUtils; +import com.utils.R; + +/** + * + * 后端接口 + * @author + * @email + * @date 2021-03-11 +*/ +@RestController +@Controller +@RequestMapping("/yonghu") +public class YonghuController { + private static final Logger logger = LoggerFactory.getLogger(YonghuController.class); + + @Autowired + private YonghuService yonghuService; + + @Autowired + private TokenService tokenService; + + @Autowired + private DictionaryService dictionaryService; + + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, HttpServletRequest request){ + logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); + PageUtils page = yonghuService.queryPage(params); + + //字典表数据转换 + List list =(List)page.getList(); + for(YonghuView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } + return R.ok().put("data", page); + } + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + YonghuEntity yonghu = yonghuService.selectById(id); + if(yonghu !=null){ + //entity转view + YonghuView view = new YonghuView(); + BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中 + + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } + + } + + /** + * 后端保存 + */ + @IgnoreAuth + @RequestMapping("/save") + public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString()); + Wrapper queryWrapper = new EntityWrapper() + .eq("studentnumber", yonghu.getStudentnumber()) + .eq("name", yonghu.getName()) + .eq("username", yonghu.getUsername()) + .eq("password", yonghu.getPassword()) + .eq("sex_types", yonghu.getSexTypes()) + .eq("phone", yonghu.getPhone()) + .eq("zhuSuLou", yonghu.getZhuSuLou()) + .eq("dormitory", yonghu.getDormitory()) + .eq("role", yonghu.getRole()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper); + if(yonghuEntity==null){ + if(yonghu.getPassword()== "" || yonghu.getPassword() == null){ + yonghu.setPassword("123456"); + } + yonghu.setRole("用户"); + yonghuService.insert(yonghu); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",yonghu.getId()) + .eq("studentnumber", yonghu.getStudentnumber()) + .eq("name", yonghu.getName()) + .eq("username", yonghu.getUsername()) + .eq("password", yonghu.getPassword()) + .eq("sex_types", yonghu.getSexTypes()) + .eq("phone", yonghu.getPhone()) + .eq("zhuSuLou", yonghu.getZhuSuLou()) + .eq("dormitory", yonghu.getDormitory()) + .eq("role", yonghu.getRole()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper); + if("".equals(yonghu.getImgPhoto()) || "null".equals(yonghu.getImgPhoto())){ + yonghu.setImgPhoto(null); + } + if(yonghuEntity==null){ + yonghuService.updateById(yonghu);//根据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()); + yonghuService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + /** + * 同意注册 + */ + @RequestMapping("/yanz") + public R delete(Integer ids){ + YonghuEntity yonghu = yonghuService.selectById(ids); + if(yonghu!= null){ + return R.error(); + } + yonghu.setYanzheng(1); + yonghuService.updateById(yonghu); + return R.ok(); + } + + + /** + * 登录 + */ + @IgnoreAuth + @PostMapping(value = "/login") + public R login(String username, String password, String role, HttpServletRequest request) { + YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper().eq("username", username)); + if(yonghu==null || !yonghu.getPassword().equals(password)) { + return R.error("账号或密码不正确"); + } + if(yonghu.getYanzheng() != 1){ + return R.error("还未通过验证请耐心等待"); + } + if(!role.equals(yonghu.getRole())){ + return R.error("权限不正确"); + } + String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "用户"); + R r = R.ok(); + r.put("token", token); + r.put("role","用户"); + r.put("userId",yonghu.getId()); + return r; + } + + /** + * 注册 + */ + @IgnoreAuth + @PostMapping(value = "/register") + public R register(@RequestBody YonghuEntity yonghu){ + // ValidatorUtils.validateEntity(user); + if(yonghuService.selectOne(new EntityWrapper().eq("username", yonghu.getUsername()).orNew().eq("phone",yonghu.getPhone())) !=null) { + return R.error("用户已存在或手机号身份证号已经被使用"); + } + yonghuService.insert(yonghu); + return R.ok(); + } + + /** + * 获取用户的session用户信息 + */ + @RequestMapping("/session") + public R getCurrYonghu(HttpServletRequest request){ + Integer id = (Integer)request.getSession().getAttribute("userId"); + YonghuEntity yonghu = yonghuService.selectById(id); + return R.ok().put("data", yonghu); + } + + + /** + * 退出 + */ + @GetMapping(value = "logout") + public R logout(HttpServletRequest request) { + request.getSession().invalidate(); + return R.ok("退出成功"); + } + +} + diff --git a/com/controller/ZhandianController.java b/com/controller/ZhandianController.java new file mode 100644 index 0000000..1f9a6b3 --- /dev/null +++ b/com/controller/ZhandianController.java @@ -0,0 +1,163 @@ +package com.controller; + + +import java.text.SimpleDateFormat; +import com.alibaba.fastjson.JSONObject; +import java.util.*; +import org.springframework.beans.BeanUtils; +import javax.servlet.http.HttpServletRequest; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; +import com.service.TokenService; +import com.utils.StringUtil; +import java.lang.reflect.InvocationTargetException; + +import com.service.DictionaryService; +import org.apache.commons.lang3.StringUtils; +import com.annotation.IgnoreAuth; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; + +import com.entity.ZhandianEntity; + +import com.service.ZhandianService; +import com.entity.view.ZhandianView; +import com.utils.PageUtils; +import com.utils.R; + +/** + * 快递站点 + * 后端接口 + * @author + * @email + * @date 2021-03-11 +*/ +@RestController +@Controller +@RequestMapping("/zhandian") +public class ZhandianController { + private static final Logger logger = LoggerFactory.getLogger(ZhandianController.class); + + @Autowired + private ZhandianService zhandianService; + + + @Autowired + private TokenService tokenService; + @Autowired + private DictionaryService dictionaryService; + + + //级联表service + + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, HttpServletRequest request){ + logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); + String role = String.valueOf(request.getSession().getAttribute("role")); + if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ + params.put("yonghuId",request.getSession().getAttribute("userId")); + } + PageUtils page = zhandianService.queryPage(params); + + //字典表数据转换 + List list =(List)page.getList(); + for(ZhandianView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } + return R.ok().put("data", page); + } + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + ZhandianEntity zhandian = zhandianService.selectById(id); + if(zhandian !=null){ + //entity转view + ZhandianView view = new ZhandianView(); + BeanUtils.copyProperties( zhandian , view );//把实体数据重构到view中 + + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } + + } + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody ZhandianEntity zhandian, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,zhandian:{}",this.getClass().getName(),zhandian.toString()); + Wrapper queryWrapper = new EntityWrapper() + .eq("zdname", zhandian.getZdname()) + .eq("address", zhandian.getAddress()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + ZhandianEntity zhandianEntity = zhandianService.selectOne(queryWrapper); + if(zhandianEntity==null){ + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // zhandian.set + // } + zhandianService.insert(zhandian); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody ZhandianEntity zhandian, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,zhandian:{}",this.getClass().getName(),zhandian.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",zhandian.getId()) + .eq("zdname", zhandian.getZdname()) + .eq("address", zhandian.getAddress()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + ZhandianEntity zhandianEntity = zhandianService.selectOne(queryWrapper); + if(zhandianEntity==null){ + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // zhandian.set + // } + zhandianService.updateById(zhandian);//根据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()); + zhandianService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + +} + diff --git a/com/dao/CommonDao.java b/com/dao/CommonDao.java new file mode 100644 index 0000000..bf3656e --- /dev/null +++ b/com/dao/CommonDao.java @@ -0,0 +1,26 @@ + +package com.dao; + +import java.util.List; +import java.util.Map; + +/** + * 通用接口 + */ +public interface CommonDao{ + List getOption(Map params); + + Map getFollowByOption(Map params); + + List getFollowByOption2(Map params); + + void sh(Map params); + + int remindCount(Map params); + + Map selectCal(Map params); + + List> selectGroup(Map params); + + List> selectValue(Map params); +} diff --git a/com/dao/ConfigDao.java b/com/dao/ConfigDao.java new file mode 100644 index 0000000..e11e63d --- /dev/null +++ b/com/dao/ConfigDao.java @@ -0,0 +1,13 @@ + +package com.dao; + + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.entity.ConfigEntity; + +/** + * 配置 + */ +public interface ConfigDao extends BaseMapper { + +} diff --git a/com/dao/DaiquDao.java b/com/dao/DaiquDao.java new file mode 100644 index 0000000..8131f6e --- /dev/null +++ b/com/dao/DaiquDao.java @@ -0,0 +1,22 @@ +package com.dao; + +import com.entity.DaiquEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.view.DaiquView; + +/** + * 待取件表 Dao 接口 + * + * @author + * @since 2021-03-11 + */ +public interface DaiquDao extends BaseMapper { + + List selectListView(Pagination page,@Param("params")Map params); + +} diff --git a/com/dao/DaiqurenDao.java b/com/dao/DaiqurenDao.java new file mode 100644 index 0000000..0e8ef6a --- /dev/null +++ b/com/dao/DaiqurenDao.java @@ -0,0 +1,22 @@ +package com.dao; + +import com.entity.DaiqurenEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.view.DaiqurenView; + +/** + * Dao 接口 + * + * @author + * @since 2021-03-11 + */ +public interface DaiqurenDao extends BaseMapper { + + List selectListView(Pagination page,@Param("params")Map params); + +} diff --git a/com/dao/DictionaryDao.java b/com/dao/DictionaryDao.java new file mode 100644 index 0000000..8bf2668 --- /dev/null +++ b/com/dao/DictionaryDao.java @@ -0,0 +1,22 @@ +package com.dao; + +import com.entity.DictionaryEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.view.DictionaryView; + +/** + * 字典表 Dao 接口 + * + * @author + * @since 2021-03-11 + */ +public interface DictionaryDao extends BaseMapper { + + List selectListView(Pagination page,@Param("params")Map params); + +} diff --git a/com/dao/JiedanDao.java b/com/dao/JiedanDao.java new file mode 100644 index 0000000..ec9b116 --- /dev/null +++ b/com/dao/JiedanDao.java @@ -0,0 +1,22 @@ +package com.dao; + +import com.entity.JiedanEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.view.JiedanView; + +/** + * 快递接单表 Dao 接口 + * + * @author + * @since 2021-03-11 + */ +public interface JiedanDao extends BaseMapper { + + List selectListView(Pagination page,@Param("params")Map params); + +} diff --git a/com/dao/TokenDao.java b/com/dao/TokenDao.java new file mode 100644 index 0000000..4e7145b --- /dev/null +++ b/com/dao/TokenDao.java @@ -0,0 +1,22 @@ + +package com.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; +import com.entity.TokenEntity; + +/** + * token + */ +public interface TokenDao extends BaseMapper { + + List selectListView(@Param("ew") Wrapper wrapper); + + List selectListView(Pagination page, @Param("ew") Wrapper wrapper); + +} diff --git a/com/dao/UserDao.java b/com/dao/UserDao.java new file mode 100644 index 0000000..e65fc3e --- /dev/null +++ b/com/dao/UserDao.java @@ -0,0 +1,22 @@ + +package com.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; +import com.entity.UserEntity; + +/** + * 用户 + */ +public interface UserDao extends BaseMapper { + + List selectListView(@Param("ew") Wrapper wrapper); + + List selectListView(Pagination page, @Param("ew") Wrapper wrapper); + +} diff --git a/com/dao/YijiedanDao.java b/com/dao/YijiedanDao.java new file mode 100644 index 0000000..a92a6b1 --- /dev/null +++ b/com/dao/YijiedanDao.java @@ -0,0 +1,22 @@ +package com.dao; + +import com.entity.YijiedanEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.view.YijiedanView; + +/** + * 已接单表 Dao 接口 + * + * @author + * @since 2021-03-11 + */ +public interface YijiedanDao extends BaseMapper { + + List selectListView(Pagination page,@Param("params")Map params); + +} diff --git a/com/dao/YonghuDao.java b/com/dao/YonghuDao.java new file mode 100644 index 0000000..99c100b --- /dev/null +++ b/com/dao/YonghuDao.java @@ -0,0 +1,22 @@ +package com.dao; + +import com.entity.YonghuEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.view.YonghuView; + +/** + * Dao 接口 + * + * @author + * @since 2021-03-11 + */ +public interface YonghuDao extends BaseMapper { + + List selectListView(Pagination page,@Param("params")Map params); + +} diff --git a/com/dao/ZhandianDao.java b/com/dao/ZhandianDao.java new file mode 100644 index 0000000..bdf50f1 --- /dev/null +++ b/com/dao/ZhandianDao.java @@ -0,0 +1,22 @@ +package com.dao; + +import com.entity.ZhandianEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.view.ZhandianView; + +/** + * 快递站点 Dao 接口 + * + * @author + * @since 2021-03-11 + */ +public interface ZhandianDao extends BaseMapper { + + List selectListView(Pagination page,@Param("params")Map params); + +} diff --git a/main.iml b/main.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/main.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file