package com.daowen.controller;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.HashMap;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.daowen.dto.Shopcart;
import com.daowen.dto.ShopcartItem;
import com.daowen.util.JsonResult;
import com.daowen.util.SequenceUtil;
import com.daowen.util.StringUtil;
import com.daowen.vo.CouponVo;
import com.daowen.vo.CreateOrderDTO;
import com.daowen.vo.OrderDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.daowen.entity.*;
import com.daowen.service.*;
import com.daowen.ssm.simplecrud.SimpleController;
import com.daowen.webcontrol.PagerMetal;
import org.springframework.web.bind.annotation.ResponseBody;
/**************************
*
* 订单控制
*
*/
@Controller
public class ShorderController extends SimpleController {
@Autowired
private ShorderService shorderSrv = null;
@Autowired
private HuiyuanService huiyuanSrv=null;
@Autowired
private OrderitemService orderitemSrv=null;
@Autowired
private CouponService couponSrv=null;
@Autowired
private ShangpinService shangpinSrv=null;
private String cartName = "shopcart";
@Autowired
private SpcommentService spcommentSrv=null;
@Autowired
private ShopcartService shopcartSrv = null;
@Override
@RequestMapping("/admin/shordermanager.do")
public void mapping(HttpServletRequest request, HttpServletResponse response) {
mappingMethod(request, response);
}
/********************************************************
******************信息注销监听支持*****************************
*********************************************************/
public void delete() {
String[] ids = request.getParameterValues("ids");
if (ids == null)
return;
for(String id : ids){
shorderSrv.delete("where id="+id);
orderitemSrv.delete("where orderid="+id);
}
}
private void saleTongji() {
String begdate = request.getParameter("begindate");
String enddate = request.getParameter("enddate");
HashMap<String,Object> map=new HashMap<>();
if(begdate!=null)
map.put("begdate",begdate);
if(enddate!=null)
map.put("enddate",enddate);
List<HashMap<String,Object>> listMap=shorderSrv.saleStat(map);
if(listMap!=null)
request.setAttribute("listMap",listMap);
dispatchParams(request, response);
String forwardurl = request.getParameter("forwardurl");
if (forwardurl == null) {
forwardurl = "/admin/xiaoshoutongjitext.jsp";
}
forward(forwardurl);
}
@ResponseBody
@PostMapping("/admin/shorder/shouhuo")
public JsonResult shouhuo(){
String oiid=request.getParameter("oiid");
String star=request.getParameter("star");
String des=request.getParameter("des");
String appraiserid=request.getParameter("appraiserid");
if(oiid==null||oiid.equals(""))
return JsonResult.error(-1,"参数异常");
Orderitem orderitem=orderitemSrv.load("where id="+oiid);
Spcomment spcomment=new Spcomment();
spcomment.setCreatetime(new Date());
spcomment.setSpid(orderitem.getSpid());
spcomment.setOrderid(orderitem.getId());
spcomment.setCresult(star==null?1:Integer.parseInt(star));
spcomment.setAppraiserid(appraiserid==null?0:Integer.parseInt(appraiserid));
spcomment.setDes(des);
spcommentSrv.save(spcomment);
int count= orderitemSrv.executeUpdate(MessageFormat.format("update orderitem set state=4 where id={0} ",oiid));
int ndCount=orderitemSrv.getRecordCount(MessageFormat.format("where orderid={0,number,#} and state=3 ",orderitem.getOrderid()));
//商品全部发货则更新订单为已发货状态
if(ndCount==0)
shorderSrv.executeUpdate(MessageFormat.format("update shorder set state=4 where id={0,number,#}",orderitem.getOrderid()));
if(count>0)
return JsonResult.success(1,"收货成功");
return JsonResult.error(-2,"收货失败");
}
@ResponseBody
@PostMapping("/admin/shorder/payment")
public JsonResult payment(){
String id=request.getParameter("id");
String paystyle=request.getParameter("paystyle");
String paypwd=request.getParameter("paypwd");
if(paypwd==null||paypwd.equals("")){
return JsonResult.error(-1,"请输入支付密码");
}
if(id==null||paypwd.equals(""))
return JsonResult.error(-2,"订单编号异常");
if(!StringUtil.isNumeric(id))
return JsonResult.error(-3,"订单编号异常");
String couponid=request.getParameter("couponid");
Shorder order=shorderSrv.load("where id="+id);
if(order==null)
return JsonResult.error(-4,"订单号不存在");
Huiyuan huiyuan= huiyuanSrv.load("where id="+order.getPurchaser());
if(huiyuan==null)
return JsonResult.error(-5,"账户信息异常");
if(!paypwd.equals(huiyuan.getPaypwd()))
return JsonResult.error(-6,"支付密码不正确");
CouponVo couponVo =null;
if(couponid!=null){
HashMap<String,Object> map=new HashMap<>();
map.put("id",couponid);
couponVo = couponSrv.loadPlus(map);
if(couponVo.getHyid()!=huiyuan.getId()){
return JsonResult.error(-1,"这尼玛盗用?");
}
}
double fee=shorderSrv.getTotalPrice(order.getId());
if(couponVo!=null) {
fee = fee - couponVo.getFee();
couponSrv.executeUpdate(" update courecord set state =2 where id="+couponVo.getCrid());
}
int count= huiyuanSrv.deduct(order.getPurchaser(),fee);
if(count<=0)
return JsonResult.error(-7,"账户余额不足");
Boolean res=shorderSrv.changeToPayed(order.getId());
if(!res)
return JsonResult.error(-8,"系统异常");
return JsonResult.success(1,"付款成功");
}
@ResponseBody
@PostMapping("/admin/shorder/cancel")
public JsonResult cancel(){
String id=request.getParameter("id");
if(!StringUtil.isNumeric(id))
return JsonResult.error(-1,"订单编号异常");
shorderSrv.executeUpdate("update shorder set state=5 where id="+id);
orderitemSrv.executeUpdate("update orderitem set state=5 where orderid="+id);
return JsonResult.success(1,"付款成功");
}
@ResponseBody
@PostMapping("/admin/shorder/info")
public JsonResult info(){
String id=request.getParameter("id");
String state=request.getParameter("state");
if(id==null||id=="")
return JsonResult.error(-1,"需要id参数");
if(!StringUtil.isNumeric(id)){
return JsonResult.error(-2,"id参数应该为数字");
}
HashMap map=new HashMap<String,Object>();
if(id!=null)
map.put("id",id);
if(state!=null)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
技术栈:springboot+jdk1.8+mybatis+mysql 实现功能:图书管理、商品管理、商品标签、优惠券管理、限时秒杀、订单管理、销售统计、商品统计、账户管理、 用户管理、会员管理、新闻资讯、用户留言、系统公告、网站导航设置
资源推荐
资源详情
资源评论
收起资源包目录
springboot项目在线图书销售系统的设计与实现.rar(项目源码) (2729个子文件)
001dfff9-edee-4304-9f44-06f1e27fe0e5 47KB
015a3b06-9372-48db-833b-0b11ad74aa84 77KB
048cb8e5-7fee-4bd7-8ed5-6560e5649c43 47KB
0527004a-b4cc-4638-be42-6b79c931133c 42KB
0898591d-ab4a-4fd4-9624-ff408ff55701 33KB
0e9d2036-278a-4929-a5b9-af8dc06f9412 77KB
1615a0cc-55ba-4f29-b80a-aa4b1caeeb24 33KB
184c4075-b8e7-44b6-bd6d-189948323784 650KB
19598f10-306d-4a51-9dcd-6ad928e53c42 47KB
19c1df39-d588-4e61-910b-002e015036a4 47KB
1a16e064-41b6-4b00-b47b-5482e5d47bfb 110KB
20695f17-c42e-4bf9-86b0-9a7b10597547 5.06MB
211088ae-2eda-40cd-ad9e-d2694df168a7 9KB
2352e05a-067b-41bb-9b3c-5454e263015e 8KB
2f687ce5-47f2-4337-8187-ac9e4414cf93 47KB
339ef14e-b861-4250-a474-68a9b69530bb 30KB
3468af28-d35a-4ff4-8420-7a5e73ad44e3 78KB
351092d8-b77a-48f0-8552-6f30db7bf04b 28KB
370f98cf-3984-4111-9615-0db8620c6be5 8KB
37d5d83e-7cad-4a99-a3fd-55f3279de599 236KB
3c7b394e-4c37-4eef-9361-ddbf0ebf4d50 26KB
4a543a66-09ba-4a21-859c-519ef3d97dba 26KB
4a847386-d1a1-4323-a9f5-b4e8c86312d2 539KB
4ab16776-9bc5-4b83-982b-9fa6be134d56 214KB
4db29849-c78c-40c0-8125-fbf8e2352070 650KB
52c7b902-2815-40c0-9443-384d35f615b0 68KB
555f9879-abde-47a9-bd41-515560348023 11KB
5eea6263-7622-40e5-b68c-c74cebb653ed 52KB
6aebc098-aee1-4d95-a9fe-ed65aceca745 30KB
6bb4c9bb-37fb-4cdb-854d-ef6ed4fb3025 5.06MB
6e5094e5-eef0-46bc-a6ac-3e7a12cfc13d 95KB
76ee4643-b9f7-476f-ae95-e3dff78f766c 79KB
79047928-ae53-4782-90fe-514ff8c88537 162KB
7ab6ecba-c39b-44d6-9bcb-21332f167d2f 147KB
7cf12af8-6a4f-4aeb-8d36-e9548c4af0f5 42KB
83e9b46f-0e24-448d-81c7-ed551b7285cc 44KB
84f79250-2b02-48fb-8ddf-a4bb267e0a5e 29KB
8a1c786a-711e-47d2-a73c-b2d8667e2aa4 5.06MB
91eca1be-6f12-487f-8881-84f46708a016 162KB
91f38393-95e3-4414-9e4e-b7579c60589e 214KB
9685aa81-24ef-4767-b936-7b1a9c384e31 650KB
98427389-147b-4614-bed2-35c821afd456 176KB
a6fb8e54-bcdf-47ca-9250-2d75cb51989c 5.06MB
a90869d7-b254-4b8b-b756-0f5f442527f0 11KB
a9500999-f36e-4d9e-b6e3-fbb598a8ec59 79KB
b27267e9-e84e-46db-bbdd-881a28e8efc4 47KB
b5c5e432-10f4-4f02-8790-f06a85ff322a 243KB
bb6527c0-c97f-44bd-a345-4661e8674c94 36KB
c0310fb2-109a-4788-9270-e1284af1ce75 77KB
c2012d17-519b-49fe-b6e1-326c58910527 54KB
c57fe6c4-4305-429c-8943-21ecd1a8f8ca 86KB
c5a33b44-a46d-4c21-8cbb-7c846d1f56cc 523KB
c5d95e16-102b-4e36-aba6-119b3da0a5da 35KB
c7161537-d2c5-40bf-9628-01d8401b5f3e 46KB
c75bd3aa-3940-4b87-893f-e5ad93e5059b 77KB
c967e4d6-ecb2-4a01-ba69-ac100bd36b2d 14KB
ccb1e915-bb81-4545-b592-8a75e595c806 55KB
cf9c82df-1928-4153-a94c-7f0f0e181460 5KB
ShorderController.class 15KB
ShangpinController.class 15KB
HuiyuanController.class 12KB
XinxiController.class 12KB
PagesettingController.class 10KB
CouponController.class 9KB
XinxiService.class 9KB
UsersController.class 9KB
ShouhouController.class 8KB
ReceaddressController.class 7KB
CommentBuilder.class 7KB
ShopcartController.class 7KB
LanmuController.class 6KB
ShangpinBuilder.class 6KB
LeavewordController.class 6KB
TgsettingController.class 6KB
SysroleController.class 6KB
RecursionTree.class 6KB
SptagController.class 6KB
SysconfigitemController.class 6KB
UploadController.class 6KB
CommentController.class 6KB
JiaodiantuController.class 6KB
NoticeController.class 6KB
ShangpinService.class 6KB
SysconfigController.class 6KB
ShoucangController.class 6KB
SitenavController.class 5KB
SubtypeController.class 5KB
FriendlinkController.class 5KB
ShorderService.class 5KB
SimpleStatistics.class 5KB
Shangpin.class 5KB
LeavewordBuilder.class 4KB
Huiyuan.class 4KB
AdminUserController.class 4KB
SingleFileUpload.class 4KB
HttpUtil.class 4KB
LanmuService.class 4KB
MailUtil.class 4KB
MySQLDatabaseUtil.class 4KB
Shopcart.class 4KB
共 2729 条
- 1
- 2
- 3
- 4
- 5
- 6
- 28
程序员小蛋
- 粉丝: 2745
- 资源: 489
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页