——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Node.js≥14
开发工具 后端:eclipse/idea/myeclipse/sts等均可配置运行 前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot二手商品系统(java+springboot+vue+mybatis+maven+mysql)
一、项目运行 环境配置:
Jdk1.8 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。
项目技术:
Spring + SpringBoot+ mybatis + Maven + Vue 等等组成,B/S模式 + Maven管理等等。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 前端启动命令:npm run serve 卖家用户 13599999999 123456 管理员 1234567890 123456 买家用户 13588888888 123456 购物流程: [卖家用户]管理商品、订单发货等 [管理员]审核用户和商品 [买家用户]充值余额、个人信息、购买商品、收货评价等
——————————CodeStart——————————
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 int commodityQuantity = Integer.parseInt(num);double totalPrice = 0.0 ;int transferToCash = (int ) integral / 100 ;if (commodityQuantity <= saleCount) { totalPrice = commodityQuantity * price - transferToCash; saleCount = saleCount - commodityQuantity; historicalSaleCount = historicalSaleCount + commodityQuantity; tradingCount = tradingCount + commodityQuantity; peopleBuy += 1 ; balance = balance - totalPrice; integral = integral - transferToCash * 100 + (int ) totalPrice; Commodity modifyCommodity = new Commodity(); modifyCommodity.setId(Integer.parseInt(id)); modifyCommodity.setSaleCount(saleCount); modifyCommodity.setHistoricalSaleCount(historicalSaleCount); modifyCommodity.setTradingCount(tradingCount); modifyCommodity.setPeopleBuy(peopleBuy); modifyCommodity.setAppraiseScore(appraiseScore); modifyCommodity.setPrice(price); commodityService.updateCommodity(modifyCommodity); User modifyUser = new User(); modifyUser.setId(Integer.parseInt(userId)); modifyUser.setBalance(balance); modifyUser.setIntegral(integral); userService.updateUser(modifyUser); double payment = totalPrice; int isTopUp = 0 ;
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 @Autowired private CommodityService commodityService;@Autowired private PurchaseService purchaseService;@Autowired private UserService userService;@PostMapping(value = "/user/information/insert", produces = "application/json;charset=utf-8") public String insertInformationByUserAndCommodity (String appraiseInformation, String appraiseService, String price, String appraiseScore, String userId, String commodityId) { HashMap<String, Object> message = new HashMap<>(); Information information = new Information(); information.setAppraiseInformation(appraiseInformation); information.setAppraiseService(Integer.parseInt(appraiseService)); information.setUserId(Integer.parseInt(userId)); information.setCommodityId(Integer.parseInt(commodityId)); if (informationService.total() == 0 ) { information.setId(1 ); } Commodity commodity = commodityService.selectCommodityById(Integer.parseInt(commodityId)); int merchantId = commodity.getUserId(); information.setMerchantId(merchantId); int i = informationService.insertInformationByUserAndCommodity(information); message.put("message" , i); double score = commodity.getAppraiseScore(); Integer confirmPurchase = commodity.getConfirmPurchase(); Integer goodComment = commodity.getGoodComment(); double totalScore = (confirmPurchase - 1 ) * score; double presentScore = (Double.parseDouble(appraiseScore) + totalScore) / confirmPurchase;
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 */ @RestController public class CartController { @Autowired private PurchaseService purchaseService; @Autowired private CommodityService commodityService; @Autowired private UserService userService; @Autowired private WalletRecordService walletRecordService; @PostMapping(value = "/user/cart/add", produces = "application/json;charset=utf-8") public String addToCart (String userId, String commodityId, String num, String isShopping) { Map<String, Object> message = new HashMap<>(); Commodity commodity = commodityService.selectCommodityById(Integer.parseInt(commodityId)); int merchantId = commodity.getUserId(); double price = commodity.getPrice(); int purchaseCount = Integer.parseInt(num); double totalPrice = purchaseCount * price; Purchase purchase = new Purchase(); purchase.setPurchaseCount(purchaseCount); purchase.setTotalPrice(totalPrice); purchase.setIsShopping(Integer.parseInt(isShopping)); purchase.setUserId(Integer.parseInt(userId)); purchase.setMerchantId(merchantId); purchase.setCommodityId(Integer.parseInt(commodityId));
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 */ @PostMapping(value = "/administrator/commodity/text", produces = "application/json;charset=utf-8") public String selectCommodityByText (String text, String currentPage, String pageSize) { Map<String, Object> message = new HashMap<>(); List<Commodity> commodities = commodityService.selectAllCommodityByText(text, Integer.parseInt(currentPage), Integer.parseInt(pageSize)); List<Map<String, Object>> information = this .selectAllCommodityAndMerchant(commodities); message.put("information" , information); Long total = commodityService.totalByText(text); message.put("total" , total); return JSON.toJSONString(message); } @PostMapping(value = "/administrator/commodity/emit", produces = "application/json;charset=utf-8") public String selectCommodityByAuditState (String currentPage, String pageSize) { Map<String, Object> message = new HashMap<>(); List<Commodity> commodities = commodityService.selectCommodityByAuditState(Integer.parseInt(currentPage), Integer.parseInt(pageSize)); List<Map<String, Object>> information = this .selectAllCommodityAndMerchant(commodities); message.put("information" , information); Long total = commodityService.totalAuditState(); message.put("total" , total); return JSON.toJSONString(message); } @PostMapping(value = "/administrator/commodity/text/audit_state", produces = "application/json;charset=utf-8") public String selectCommodityByTextAndAuditState (String text, String currentPage, String pageSize) { Map<String, Object> message = new HashMap<>(); List<Commodity> commodities = commodityService.selectAllCommodityByTextAndAuditState(text, Integer.parseInt(currentPage), Integer.parseInt(pageSize));
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 @RestController public class UserController { @Autowired private UserService userService; @PostMapping(value = "/administrator/user/all", produces = "application/json;charset=utf-8") public String allUser () { Map<String, Object> message = new HashMap<>(); List<User> users = userService.selectAllUsers(); message.put("message" , users); return JSON.toJSONString(message); } @PostMapping(value = "/administrator/user/update", produces = "application/json;charset=utf-8") public String updateDefinedUser (String id, String enableState, String auditRegistryState, String currentPage, String pageSize) { Map<String, Object> message = new HashMap<>(); User user = new User();
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 @RestController public class CommentOfCommodityController { @Autowired private CommodityService commodityService; @Autowired private InformationService informationService; @Autowired private UserService userService; @PostMapping(value = "/merchant/commodity/issued/all", produces = "application/json;charset=utf-8") public String selectCommodityByCurrentMerchantAndAuditState (String merchantId, String currentPage, String pageSize) { Map<String, Object> message = new HashMap<>(); List<Commodity> commodities = commodityService.selectCommodityByCurrentMerchant(Integer.parseInt(merchantId), Integer.parseInt(currentPage), Integer.parseInt(pageSize)); message.put("commodities" , commodities); Long total = commodityService.totalCommodityByCurrentMerchant(Integer.parseInt(merchantId)); message.put("total" , total);
——————————PayStart——————————
项目链接: https://javayms.github.io?id=071023491103200xm https://javayms.pages.dev?id=071023491103200xm