package com.daowen.controller;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.daowen.entity.Caigou;
import com.daowen.entity.Shangpin;
import com.daowen.entity.Spcategory;
import com.daowen.service.CaigouService;
import com.daowen.service.DuixiangService;
import com.daowen.service.ShangpinService;
import com.daowen.service.SpcategoryService;
import com.daowen.service.SptagService;
import com.daowen.ssm.simplecrud.SimpleController;
import com.daowen.util.SequenceUtil;
import com.daowen.webcontrol.PagerMetal;
@Controller
public class ShangpinController extends SimpleController {
@Override
@RequestMapping("/admin/shangpinmanager.do")
public void mapping(HttpServletRequest request, HttpServletResponse response) {
mappingMethod(request, response);
}
public void shenpi() {
String id = request.getParameter("id");
String forwardurl = request.getParameter("forwardurl");
String spstate = request.getParameter("spstate");
String reply = request.getParameter("reply");
String shenpiren = request.getParameter("shenpiren");
int statuscode = 3;
// 验证错误url
String errorurl = request.getParameter("errorurl");
if (id == null)
return;
Shangpin shangpin = shangpinSrv.load(" where id=" + id);
if (shangpin == null)
return;
if (spstate != null)
statuscode = Integer.parseInt(spstate);
shangpin.setSpstate(statuscode);
shangpinSrv.update(shangpin);
if (forwardurl == null) {
forwardurl = "/admin/shangpinmanager.do?actiontype=get";
}
redirect(forwardurl);
}
public void shangjia() {
String[] ids = request.getParameterValues("ids");
if (ids == null)
return;
String spliter = ",";
shangpinSrv.executeUpdate(" update shangpin set state=1 where id in("
+ join(spliter, ids) + ")");
try {
response.getWriter().write(new Integer(ids.length));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void xiajia() {
String[] ids = request.getParameterValues("ids");
if (ids == null)
return;
String spliter = ",";
String SQL = " update shangpin set state=2 where id in("
+ join(spliter, ids) + ")";
System.out.println("sql=" + SQL);
shangpinSrv.executeUpdate(SQL);
try {
response.getWriter().write(new Integer(ids.length));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void kucunadd() {
String forwardurl = request.getParameter("forwardurl");
String id = request.getParameter("id");
String supplor = request.getParameter("supplor");
String cgdate = request.getParameter("cgdate");
String cgren = request.getParameter("cgren");
if (id == null)
return;
Shangpin shangpin = shangpinSrv.load(new Integer(id));
if (shangpin == null)
return;
String shuliang = request.getParameter("shuliang");
String danwei = request.getParameter("danwei");
if (shuliang != null) {
shangpin.setKucun(shangpin.getKucun() + Integer.parseInt(shuliang));
shangpin.setDanwei(danwei);
shangpinSrv.update(shangpin);
Caigou caigou = new Caigou();
caigou.setSpno(shangpin.getSpno());
caigou.setSpname(shangpin.getName());
caigou.setSupplor(supplor);
caigou.setCount(Double.parseDouble(shuliang));
if (cgdate != null) {
try {
caigou.setCgdate(new SimpleDateFormat("yyyy-MM-dd")
.parse(cgdate));
} catch (ParseException e) {
e.printStackTrace();
}
} else {
caigou.setCgdate(new Date());
}
caigou.setCgren(cgren == null ? "" : cgren);
caigou.setDanwei(danwei == null ? "" : danwei);
caigouSrv.save(caigou);
}
if (forwardurl == null) {
forwardurl = "/admin/shangpinmanager.do?actiontype=get";
}
redirect(forwardurl);
}
public void delete() {
String[] ids = request.getParameterValues("ids");
if (ids == null)
return;
String spliter = ",";
String SQL = " where id in(" + join(spliter, ids)
+ ")";
System.out.println("sql=" + SQL);
shangpinSrv.delete(SQL);
}
public void save() {
String forwardurl = request.getParameter("forwardurl");
String name = request.getParameter("name");
String jiage = request.getParameter("jiage");
String dazhe = request.getParameter("dazhe");
String tuijian = request.getParameter("tuijian");
String zuixin = request.getParameter("zuixin");
String hot = request.getParameter("hot");
String sptype = request.getParameter("sptype");
String sptypeid = request.getParameter("sptypeid");
String tupian = request.getParameter("tupian");
String jieshao = request.getParameter("jieshao");
String pubren = request.getParameter("pubren");
String subtitle = request.getParameter("subtitle");
String discount = request.getParameter("discount");
String tuihuan = request.getParameter("tuihuan");
String jifen = request.getParameter("jifen");
String baozhuang = request.getParameter("baozhuang");
String dxid = request.getParameter("dxid");
String shdx = request.getParameter("shdx");
String chandi = request.getParameter("chandi");
String tagid = request.getParameter("tagid");
String tagname = request.getParameter("tagname");
String danwei=request.getParameter("danwei");
SimpleDateFormat sdfshangpin = new SimpleDateFormat("yyyy-MM-dd");
Shangpin shangpin = new Shangpin();
shangpin.setName(name == null ? "" : name);
shangpin.setSpno(SequenceUtil.buildSequence("SP"));
shangpin.setJiage(jiage == null ? (double) 0 : new Double(jiage));
shangpin.setDazhe(dazhe == null ? 0 : new Integer(dazhe));
shangpin.setTuijian(tuijian == null ? 0 : new Integer(tuijian));
shangpin.setZuixin(zuixin == null ? 0 : new Integer(zuixin));
shangpin.setHot(hot == null ? 0 : new Integer(hot));
shangpin.setSptype(sptype == null ? "" : sptype);
shangpin.setSptypeid(sptypeid == null ? 0 : new Integer(sptypeid));
shangpin.setTupian(tupian == null ? "" : tupian);
shangpin.setSpstate(2);
shangpin.setJieshao(jieshao == null ? "" : jieshao);
shangpin.setBaozhuang(baozhuang == null ? "" : baozhuang);
shangpin.setSubtitle(subtitle == null ? "" : subtitle);
if (discount != null)
shangpin.setHyjia(shangpin.getJiage()
* Double.parseDouble(discount));
else
shangpin.setHyjia(shangpin.getJiage());
shangpin.setChandi(chandi == null ? "" : chandi);
shangpin.setState(1);
shangpin.setDanwei(danwei==null?"":danwei);
shangpin.setShdx(shdx == null ? "" : shdx);
shangpin.setJifen(jifen == null ? 0 : Integer.parseInt(jifen));
shangpin.setPubtime(new Date());
shangpin.setDxid(dxid == null ? 0 : Integer.parseInt(dxid));
shangpin.setPubren(pubren == null ? "" : pubren);
shangpin.setTagid(tagid == null ? 0 : Integer.parseInt(tagid));
shangpin.setTagname(tagname == null ? "" : tagname);
shangpinSrv.save(shangpin);
if (forwardurl == null) {
forwardurl = "/admin/shangpinmanager.do?actiontype=get";
}
redirect(forwardurl);
}
public void update() {
String forwardurl = request.getParameter("forwardurl");
String errorurl = request.getParameter("errorurl");
String id = request.getParameter("id");
if (id == null)
return;
Shangpin shangpin = shangpinSrv.load(new Integer(id));
if (shangpin == null)
return;
String name = request.getParameter("name");
String jiage = request.getParameter("jiage");
String dazhe = request.getParameter("dazhe");
String tuijian = request.getParameter("tuijian");
String zuixin = request.getParameter("zuixin");
String hot = request.getParameter("hot");
String sptype = request.getParameter("sptype");
String sptypeid = request.getParameter("sptypeid");
String tupian = request.getParameter("tupian");
String jie
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/d4bb382e060d455f8728e6d8c9e204ca_qq_36584673.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
十小大
- 粉丝: 1w+
- 资源: 1517
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 电气类117、变电站真实巡检电力设备检测数据集(7500多张+15类+YOLO格式txt标签)-第二部分
- 电气类、117.变电站真实巡检电力设备检测数据集(7500多张+15类+YOLO格式txt标签)-第一部分
- IMG_20180720_124347_01.jpg
- IMG20240621095811.jpg
- jQuery 库.docx
- 基于 C 实现的图像处理(BMP)课程设计
- ST MCSDK 6.3.0
- 基于 C++实现的虚拟航班订票系统【C++课程设计】
- 111111111111111111
- 海信智能电视刷机数据 LED43K5100U(0000) 生产用软件数据 务必确认机编一致 强制刷机 整机USB升级程序
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)