基于javaweb的SSH微信小程序果蔬商城管理系统(java+ssh+jsp+javascript+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

182024222603

192024222603

212024222603

222024222603

232024222603

242024222603

252024222603

262024222603

272024222603

282024222603

292024222603

302024222603

322024222603

332024222603

基于javaweb的SSH微信小程序果蔬商城管理系统(java+ssh+jsp+javascript+mysql)

管理员(web)端:
http://localhost:8080
admin 123456

用户(小程序)端
1.使用微信开发者工具导入项目
2.导入成功后编译运行
3.运行成功后登录账号:
user1 123456
user2 123456

程序功能:
1.小程序前台:用户注册登录、首页、轮播图、新品推荐、分类、购物车、我的订单。
2.网站后台:管理员登录、用户管理、商品类别管理、商品管理、订单管理、公告管理。

  1. 后端:spring+struts+hibernate
  2. 前端:JSP+css+javascript+jquery

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
			try {
replaceAll = string.replaceAll("\\\\", "/").replaceAll("shop", "");
g2.getGoods().setUrl1(replaceAll);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
jsonMap.put("listgoods",gg);
return "json";
}
/**
* 跳转到添加页面
* @return
*/
public String add(){
return SUCCESS;
}

/**
* 执行添加
* @return
*/
public String exAdd(){

List<Goods> listByAlias = goodsService.listByAlias("from Car where user.id="+userId+"and goods.id="+goodsId, null);
if(isEmpty(listByAlias)){
User user = new User();
user.setId(userId);
Goods byId = goodsService.getById(goodsId);
car.setGoods(byId);
car.setUser(user);
carService.save(car);

}
jsonMap.put("result", 1);
return "json";
}

/**
* 查看详情页面
* @return
*/
public String view(){
Car n = carService.getById(car.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}

/**
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
               HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST);
String root = "D:/my/upload";
InputStream is = new FileInputStream(file.get(i));
String f = fileFileName.get(i);
f = UUIDUtils.create() + i + fileFileName.get(i);
OutputStream os = new FileOutputStream(new File(root, f));
byte[] buffer = new byte[500];
int length = 0;
while (-1 != (length = is.read(buffer, 0, buffer.length))) {
os.write(buffer);
}
os.close();
is.close();
if (i == 0){
goods.setUrl1("\\upload\\" + f);
}
if (i == 1){
goods.setUrl2("\\upload\\" + f);
}
if (i == 2){
goods.setUrl3("\\upload\\" + f);
}
if (i == 3){
goods.setUrl4("\\upload\\" + f);
}
}
}

goods.setIsDelete(0);
goodsService.save(goods);
ActionContext.getContext().put("url", "/goods_goods.do");
return "redirect";
}

/**
* 查看详情页面
* @return
*/
public String view(){
Goods n = goodsService.getById(goods.getId());
ActionContext.getContext().put("Obj", n);
return SUCCESS;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	HttpServletRequest request = getRequest();
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"";
List<LbDto> lbs = new ArrayList<LbDto>();
List<Lb> pagers = lbService.listByAlias("from Lb where 1=1 and isDelete = 0",null);
if(!isEmpty(pagers)){
for(Lb lb : pagers){
LbDto ld = new LbDto();
ld.setLb(lb);
//查询品牌
List<Pp> listByAlias = ppService.listByAlias("from Pp where 1=1 and lb.id="+lb.getId(), null);
if(!isEmpty(listByAlias)){
for(Pp p : listByAlias){
String string = basePath+p.getCpUrl();
String replaceAll;
try {
replaceAll = string.replaceAll("\\\\", "/").replaceAll("shop", "");
p.setCpUrl(replaceAll);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
ld.setPps(listByAlias);
lbs.add(ld);
}

}

jsonMap.put("lbs", lbs);
return "json";
}

public String userpp(){
HttpServletRequest request = getRequest();
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"";
List<Pp> listByAlias = ppService.listByAlias("from Pp where 1=1 and lb.id="+lbId, null);
if(!isEmpty(listByAlias)){
for(Pp p : listByAlias){
String string = basePath+p.getCpUrl();
String replaceAll;
try {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	  // dataMap中的数据将会被Struts2转换成JSON字符串,所以这里要先清空其中的数据
jsonMap.clear();
jsonMap.put("success", true);
return JSON_TYPE;
}
//-------------------------华丽分割线---------------------------------------------//

//=============公=======共=======方=======法==========区=========start============//
/**
* 列表分页查询
*/
public String pp(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Pp where 1=1 and lb.id="+lbId);
sb = sb.append("order by id desc");
List<Pp> pagers = ppService.listByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", pp);
getActionContext().put("lbId", lbId);
return SUCCESS;
}

/**
* 跳转到添加页面
* @return
*/
public String add(){
getActionContext().put("lbId", lbId);
return SUCCESS;
}

/**
* 执行添加
* @return
* @throws IOException
*/
public String exAdd() throws IOException{
if(fileFileName != null){
String root = "D:/my/upload";
InputStream is = new FileInputStream(file);
fileFileName = UUIDUtils.create()+fileFileName;
OutputStream os = new FileOutputStream(new File(root, fileFileName));
System.out.println("fileFileName: " + fileFileName);
System.out.println("file: " + file.getName());
System.out.println("file: " + file.getPath());
byte[] buffer = new byte[500];
int length = 0;

while(-1 != (length = is.read(buffer, 0, buffer.length)))
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	ma.setId(manage.getId());*/
manageService.updateInfo(manage);
out = resp.getWriter();
out.write(JSONArray.fromObject(1).toString());

}

public String delManage(){
manageService.deleteInfo(manage.getId());
ActionContext.getContext().put("url", "/manage_manage.do");
return "redirect";
}


















//=============================================================================================================

public int getSayId() {
return sayId;
}
public void setSayId(int sayId) {
this.sayId = sayId;
}

private File file;

public File getFile() {
return file;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

/**
* @ClassName:
* @Description:
*/

@Controller("goodsAction")
@Scope("prototype")
public class GoodsAction extends BaseAction implements ModelDriven<Goods>{

private static final long serialVersionUID = 1L;



//==========model==============
private Goods goods;
@Override
public Goods getModel() {
if(goods==null) goods = new Goods();
return goods;
}
//==========model==============
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private GoodsService goodsService;
@Autowired
private PpService ppService;

private Integer ppId;


//依赖注入 end dao/service/===

//-------------------------华丽分割线---------------------------------------------

//============自定义参数start=============

//============自定义参数end=============


//-------------------------华丽分割线---------------------------------------------

//============文件上传start=======================================================


项目链接:
https://javayms.github.io?id=172024222603201lj
https://javayms.pages.dev?id=172024222603201lj