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<String, Object> 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<JiedanView> list =(List<JiedanView>)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<JiedanEntity> queryWrapper = new EntityWrapper<JiedanEntity>()
.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<JiedanEntity> queryWrapper = new EntityWrapper<JiedanEntity>()
.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<YijiedanEntity> queryWrapper = new EntityWrapper<YijiedanEntity>()
.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.s
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【基于SSM+Jsp的校园快递一站式服务系统的设计与实现】高分通过项目,已获导师指导。 本项目是一套基于SSM+Jsp的校园快递一站式服务系统,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的Java学习者。也可作为课程设计、期末大作业 包含:项目源码、数据库脚本、开发说明文档、部署视频、代码讲解视频、全套软件等,该项目可以直接作为毕设使用。 项目都经过严格调试,确保可以运行!
资源推荐
资源详情
资源评论
收起资源包目录
Java项目-基于SSM+Jsp的校园快递一站式服务系统的设计与实现(源码+数据库脚本+部署视频+代码讲解视频+全套软件) (877个子文件)
style.css 835KB
bootstrap4.2.1.min.css 150KB
bootstrap.min.css 141KB
bootstrap.css 120KB
bootstrap.min.css 118KB
material-design-iconic-font.min.css 93KB
animate.css 68KB
style.css 66KB
style.default.css 66KB
linea-icon.css 46KB
ueditor.css 44KB
font-awesome.min.css 38KB
ueditor.min.css 34KB
font-awesome.min.css 30KB
jquery.treetable.theme.default.css 25KB
lightgallery.css 25KB
animate.css 23KB
styles.css 23KB
entypo-icon.css 23KB
all.css 21KB
font-awesome.css 21KB
video-js.css 21KB
image.css 19KB
jquery.idealforms.css 17KB
themify-icons.css 16KB
themify-icons.css 16KB
jquery.dataTables.min.css 15KB
video.css 15KB
attachment.css 15KB
square.min.css 14KB
simple-line-icons.css 14KB
all.css 13KB
bootstrap-select.css 13KB
dropzone.css 11KB
video-js.min.css 11KB
bootstrap-switch.css 11KB
bootstrap-datetimepicker.min.css 11KB
extra-pages.css 11KB
ladda.min.css 10KB
filter.css 9KB
tooltipster.css 9KB
pe-icon-7-stroke.css 9KB
awesome-bootstrap-checkbox.css 9KB
calendar.css 9KB
responsive.css 8KB
shCoreDefault.css 7KB
pe-icon-7-styles.css 7KB
css.css 7KB
social.css 7KB
jquery-jvectormap.css 6KB
clockface.css 6KB
jquery.steps.css 6KB
dripicon.css 5KB
weather-icons.min.css 5KB
footable.core.css 5KB
jquery.toast.min.css 5KB
dataTables.bootstrap4.min.css 5KB
datepicker.css 5KB
tabelizer.min.css 5KB
datepicker.css 5KB
datepicker.css 5KB
footable.standalone.css 5KB
signin.css 5KB
media.css 5KB
slidebars.css 4KB
skin-select.css 4KB
datepicker.css 4KB
scrawl.css 4KB
DT_bootstrap.css 4KB
datepicker.css 4KB
bootstrap-timepicker.css 3KB
green.css 3KB
yellow.css 3KB
red.css 3KB
blue.css 3KB
violet.css 3KB
codemirror.css 3KB
owl.carousel.min.css 3KB
bootstrap-colorpicker.css 3KB
maki-icons.css 3KB
jquery.treeview.css 3KB
profile.css 3KB
charts.css 3KB
jquery.searchableSelect.css 3KB
background.css 2KB
bootstrap-wysihtml5.css 2KB
awwwards.css 2KB
jquery.stepy.css 2KB
responsive-table.css 2KB
emotion.css 2KB
dialogbase.css 2KB
jquery.pnotify.default.css 2KB
music.css 2KB
demo.css 1KB
acc-wizard.min.css 1KB
jquery.easy-pie-chart.css 1KB
pace-theme-center-simple.css 1KB
uploader.css 1KB
edittable.css 1KB
editor.css 1KB
共 877 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
Java骨灰级码农
- 粉丝: 4310
- 资源: 755
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C# 中事件与委托应用示例,一个很简单的入门demo
- C++串口通信与数据移位实现方法详解.txt
- 通过GPIO控制LED灯 python语言和树莓派
- 问题汇总_C语言、数据结构.docx
- 2023-04-06-项目笔记 - 第二百七十七阶段 - 4.4.2.275全局变量的作用域-275 -2025.10.05
- 检测植物上或树上的叶子的图像数据集
- 基于C++的串口数据CRC-16校验实现与应用
- TI 毫米波雷达-ADC Buffer的交错与非交错采样源文件
- TA-Lib-0.4.26-cp310-cp310-win-amd64.whl
- 2024-10-05 20_42_57-1d975af1.mp3
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功