基于javaweb的SpringBoot社区疫情防控系统(java+springboot+maven+html+mysql+mybatis)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

002023212309

012023212309

032023212309

042023212309

052023212309

062023212309

072023212309

082023212309

092023212309

102023212309

基于javaweb的SpringBoot社区疫情防控系统(java+springboot+maven+html+mysql+mybatis)

超级管理员(admin_info表):
superadmin 123456

管理员(business_info表):
admin 123456

*超级管理员比管理员多出的功能:[超级管理员管理]、[管理员管理]

用户(user_info表):
user1 123456
user2 123456

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24



@RestController
@RequestMapping(value = "/adminInfo")
public class AdminInfoController {

@Resource
private AdminInfoService adminInfoService;

@PostMapping
public Result<AdminInfo> add(@RequestBody AdminInfoVo adminInfo) {
adminInfoService.add(adminInfo);
return Result.success(adminInfo);
}

@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
adminInfoService.delete(id);
return Result.success();
}

@PutMapping
public Result update(@RequestBody AdminInfoVo adminInfo) {
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



@RestController
@RequestMapping(value = "/userInfo")
public class UserInfoController {

@Resource
private UserInfoService userInfoService;

@PostMapping
public Result<UserInfo> add(@RequestBody UserInfoVo userInfo) {
userInfoService.add(userInfo);
return Result.success(userInfo);
}

@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
userInfoService.delete(id);
return Result.success();
}

@PutMapping
public Result update(@RequestBody UserInfoVo userInfo) {
userInfoService.update(userInfo);
return Result.success();
}

@GetMapping("/{id}")
public Result<UserInfo> detail(@PathVariable Long id) {
UserInfo userInfo = userInfoService.findById(id);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
		resultMap.put("advertiserInfo", advertiserInfoService.findAll().size());

return Result.success(resultMap);
}
}



@RestController
@RequestMapping("/files")
public class NxSystemFileController {

private static final String BASE_PATH = System.getProperty("user.dir") + "/src/main/resources/static/file/";

@Resource
private NxSystemFileInfoService nxSystemFileInfoService;

@PostMapping("/upload")
public Result upload(MultipartFile file, HttpServletRequest request) throws IOException {
String originName = file.getOriginalFilename();
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

/**
* 批量通过excel添加信息
* @param file excel文件
* @throws IOException
*/
@PostMapping("/upload")
public Result upload(MultipartFile file) throws IOException {

List<AdvertiserInfo> infoList = ExcelUtil.getReader(file.getInputStream()).readAll(AdvertiserInfo.class);
if (!CollectionUtil.isEmpty(infoList)) {
// 处理一下空数据
List<AdvertiserInfo> resultList = infoList.stream().filter(x -> ObjectUtil.isNotEmpty(x.getName())).collect(Collectors.toList());
for (AdvertiserInfo info : resultList) {
advertiserInfoService.add(info);
}
}
return Result.success();
}

@GetMapping("/getExcelModel")
public void getExcelModel(HttpServletResponse response) throws IOException {
// 1. 生成excel
Map<String, Object> row = new LinkedHashMap<>();
row.put("name", "系统公告");
row.put("content", "这是系统公告,管理员可以在后台修改");
row.put("time", "TIME");

List<Map<String, Object>> list = CollUtil.newArrayList(row);

// 2. 写excel
ExcelWriter writer = ExcelUtil.getWriter(true);
writer.write(list, true);

response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename=advertiserInfoModel.xlsx");

ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
writer.close();
IoUtil.close(System.out);
}
}

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
      }

// 下单 清空购物车
cartInfoService.empty(userId, level);
}

@Transactional
public void delete(Long id) {
orderInfoDao.deleteById(id);
orderGoodsRelDao.deleteByOrderId(id);
}

public void deleteGoods(Long goodsId, Long orderId) {
orderGoodsRelDao.deleteByGoodsIdAndOrderId(goodsId, orderId);
}

public OrderInfo findByOrderId(Long orderId) {
return orderInfoDao.findById(orderId);
}

public void changeStatus(Long id, String status) {
OrderInfo order = orderInfoDao.findById(id);
Long userId = order.getUserId();
Integer level = order.getLevel();
if (level == 1) {
AdminInfo user = adminInfoService.findById(userId);
if (status.equals("待发货")) {
Double account = user.getAccount();
Double totalPrice = order.getTotalPrice();
if(account < totalPrice) {
throw new CustomException("-1", "账户余额不足");
}
user.setAccount(user.getAccount() - order.getTotalPrice());
adminInfoService.update(user);
}
if ("已退款".equals(status) || "已退货".equals(status)) {
user.setAccount(user.getAccount() + order.getTotalPrice());
adminInfoService.update(user);
}
orderInfoDao.updateStatus(id, status);
1
2
3
4
5
6
7
8
9
10
11
		if (level == 3) {
account = userInfoService.findById(userId);
}

return account;
}
}





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