package com.lyy.photovoltaic.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lyy.photovoltaic.beans.*;
import com.lyy.photovoltaic.common.utils.DateUtil;
import com.lyy.photovoltaic.common.utils.MyRandom;
import com.lyy.photovoltaic.common.vo.ResultCode;
import com.lyy.photovoltaic.common.vo.ResultVO;
import com.lyy.photovoltaic.mapper.*;
import com.lyy.photovoltaic.service.OrdersDetailsService;
import com.lyy.photovoltaic.service.OrdersService;
import com.lyy.photovoltaic.service.UserEquipmentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class OrdersServiceImpl implements OrdersService {
@Autowired
OrdersMapper ordersMapper;
@Autowired
OrdersDetailsService ordersDetailsService;
@Autowired
OrdersDetailsMapper ordersDetailsMapper;
@Autowired
UsersInfoMapper usersInfoMapper;
@Autowired
UsersEquipmentsListsMapper usersEquipmentsListsMapper;
@Autowired
UserEquipmentsService userEquipmentsService;
@Override
public ResultVO addOrders(JSONObject jsonObject) {
// System.out.println(jsonObject);
Orders order = new Orders();
String string = jsonObject.getJSONObject("data").getString("userId");
String oId = System.currentTimeMillis() + string;
order.setOrderId(oId);
order.setOrderOwner(jsonObject.getJSONObject("data").getString("orderName"));
order.setOrderPhone(jsonObject.getJSONObject("data").getString("phone"));
order.setOrderAddress(jsonObject.getJSONObject("data").getString("address"));
order.setOrderCreatetime(new Date());
order.setOrderStatus(true);
order.setOrderIsshowtouser(true);
order.setOrderAmount(jsonObject.getJSONObject("data").getString("amount"));
order.setUserId(jsonObject.getJSONObject("data").getString("userId"));
JSONArray jsonArray = jsonObject.getJSONObject("data").getJSONArray("orderDetails");
// System.out.println(jsonArray);
/* 用StringJoiner作字符串拼接 */
StringJoiner EId = new StringJoiner(","); //分别为:分隔符、前缀、后缀,也可以只传第一个参数分隔符
StringJoiner UCId = new StringJoiner(",");
if (jsonArray != null && jsonArray.size() > 0) {
OrdersDetails[] ordersDetails = new OrdersDetails[jsonArray.size()];
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jo = jsonArray.getJSONObject(i);
String eId = jo.get("eId").toString();
EId.add(eId);
String uCId = System.currentTimeMillis() + MyRandom.getStringRandom() + eId;
UCId.add(uCId);
String eCount = jo.get("count").toString();
String eRealPrice = jo.get("realPrice").toString();
String eName = jo.get("name").toString();
System.out.println(eName);
BigDecimal eRealPrice1 = new BigDecimal(eRealPrice);
String ePrice = jo.get("price").toString();
BigDecimal ePrice1 = new BigDecimal(ePrice);
ordersDetails[i] = new OrdersDetails();
ordersDetails[i].setOrderDetailsId(uCId);
ordersDetails[i].seteId(eId);
ordersDetails[i].seteName(eName);
ordersDetails[i].seteCount(Integer.valueOf(eCount));
ordersDetails[i].seteRealprice(eRealPrice1);
ordersDetails[i].setePrice(ePrice1);
// System.out.println(i);
ResultVO resultVO = ordersDetailsService.addOrdersDetails(ordersDetails[i]);
// System.out.println("ordersDetails:"+ordersDetails[i]);
}
}
// System.out.println("EId:"+EId);
order.setOrderDetailsId(UCId.toString());
// System.out.println("UCId:"+UCId);
// System.out.println(order);
int i = ordersMapper.insert(order);
if (i > 0) {
return new ResultVO(ResultCode.SUCCESS, "添加订单成功", order);
}
return new ResultVO(ResultCode.FAILED, "添加订单失败", null);
}
@Override
public ResultVO findOrders(String uId) {
Example example = new Example(Orders.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId", uId);
criteria.andEqualTo("orderIsshowtouser", true);
List<Orders> orders = ordersMapper.selectByExample(example);
for (Orders order : orders) {
System.out.println(order);
String orderDetailsId = order.getOrderDetailsId();
String[] stringArr = orderDetailsId.split(",");
List<OrdersDetails> orderDetailsLists = ordersDetailsMapper.findOrderDetailsLists(stringArr);
order.setOrderDetailsList(orderDetailsLists);
}
if (orders.size() > 0) {
return new ResultVO(ResultCode.SUCCESS, "查询订单成功", orders);
}
return new ResultVO(ResultCode.FAILED, "查询历史订单失败", null);
}
@Override
public ResultVO logicDeleteOrders(String orderId) {
// System.out.println(orderId);
Orders order = new Orders();
order.setOrderIsshowtouser(false);
Example example = new Example(Orders.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("orderId", orderId);
int i = ordersMapper.updateByExampleSelective(order, example);
if (i > 0) {
return new ResultVO(ResultCode.SUCCESS, "逻辑删除历史订单成功");
}
return new ResultVO(ResultCode.FAILED, "逻辑删除成功历史订单失败", null);
}
@Override
public ResultVO unProcessOrders() {
Example example = new Example(Orders.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIsNull("staffId");
criteria.andIsNull("orderDeliveryAddress");
// criteria.andNotEqualTo("staffId", null);
// criteria.andNotEqualTo("orderDeliveryAddress", null);
List<Orders> orders = ordersMapper.selectByExample(example);
for (Orders order : orders) {
// System.out.println(order);
String orderDetailsId = order.getOrderDetailsId();
// System.out.println(orderDetailsId);
String[] stringArr = orderDetailsId.split(",");
// System.out.println(Arrays.toString(stringArr));
List<OrdersDetails> orderDetailsLists = ordersDetailsMapper.findOrderDetailsLists(stringArr);
order.setOrderDetailsList(orderDetailsLists);
// System.out.println(orderDetailsLists);
// System.out.println(orders);
// orderDetailsLists.ge
}
// System.out.println("-------------");
// System.out.println(orders);
if (orders.size() > 0) {
return new ResultVO(ResultCode.SUCCESS, "查看未处理订单成功", orders);
}
return new ResultVO(ResultCode.FAILED, "查看未处理订单失败", null);
}
@Override
public ResultVO UpdateOrders(String orderId, JSONObject jsonObject) {
Orders order = ordersMapper.selectByPrimaryKey(orderId);
// System.out.println(jsonObject);
order.setOrderDeliveryAddress(jsonObject.getString("orderDeliveryAddress"));
order.setStaffId(jsonObject.getString("staffId"));
// System.out.println(order);
//通过用户Id查看用户个人设备列表Id
Example example = new Example(Orders.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId", order.getUserId());
UsersInfo usersInfo = usersInfoMapper.selectOneByExample(
没有合适的资源?快使用搜索试试~ 我知道了~
毕业设计基于springboot+vue的光伏电站监控管理系统源代码+数据库,前后端分离
共392个文件
xml:167个
class:103个
java:102个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 24 浏览量
2024-09-23
10:59:30
上传
评论
收藏 42.31MB ZIP 举报
温馨提示
毕业设计基于springboot+vue的光伏电站监控管理系统源代码+数据库,前后端分离,,该项目是个人毕设项目,答辩评审分达到98分,代码都经过调试测试,确保可以运行!欢迎下载使用,可用于小白学习、进阶。该资源主要针对计算机、通信、人工智能、自动化等相关专业的学生、老师或从业者下载使用,亦可作为期末课程设计、课程大作业、毕业设计等。项目整体具有较高的学习借鉴价值!基础能力强的可以在此基础上修改调整,以实现不同的功能。 毕业设计基于springboot+vue的光伏电站监控管理系统源代码+数据库,前后端分离,,该项目是个人毕设项目,答辩评审分达到98分,代码都经过调试测试,确保可以运行!欢迎下载使用,可用于小白学习、进阶。该资源主要针对计算机、通信、人工智能、自动化等相关专业的学生、老师或从业者下载使用,亦可作为期末课程设计、课程大作业、毕业设计等。项目整体具有较高的学习借鉴价值!基础能力强的可以在此基础上修改调整,以实现不同的功能。 毕业设计基于springboot+vue的光伏电站监控管理系统源代码+数据库,前后端分离,,该项目是个人毕设项目,答辩评审分达到98分,代码都经过调
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计基于springboot+vue的光伏电站监控管理系统源代码+数据库,前后端分离 (392个子文件)
OrdersServiceImpl.class 13KB
Orders.class 8KB
EquipmentsServiceImpl.class 8KB
Equipments.class 7KB
UserCartDetailsServiceImpl.class 6KB
UsersInfo.class 6KB
UserServiceImpl.class 6KB
UserEquipmentsServiceImpl.class 6KB
StaffsServiceImpl.class 6KB
NoticeServiceImpl.class 6KB
Staffs.class 5KB
AliPayConfig.class 5KB
EquipmentsServiceImplTest.class 5KB
EquipmentController.class 5KB
UsersEquipments.class 5KB
AliPayController.class 5KB
LeaveMessageServiceImpl.class 5KB
PublicInformation.class 4KB
PersonalEquipments.class 4KB
Notice.class 4KB
UserCartDetails.class 4KB
OrdersDetails.class 4KB
UserEquipmentsServiceImplTest.class 4KB
AdministratorServiceImpl.class 4KB
ImagesServiceImpl.class 4KB
ResultVO.class 4KB
CheckTokenInterceptor.class 4KB
NoticeController.class 4KB
UserCartDetailsController.class 4KB
StaffsController.class 3KB
SwaggerConfig.class 3KB
UsersInfoServixeImpl.class 3KB
MyMD5Util.class 3KB
OrdersController.class 3KB
UserCartServiceImpl.class 3KB
OrdersDetailsServiceImpl.class 3KB
ResultCode.class 3KB
LeaveMessageController.class 3KB
PersonalEquipmentsLists.class 3KB
UserController.class 3KB
UsersEquipmentsLists.class 3KB
UsersInfoController.class 2KB
AliPay.class 2KB
UserEquipmentsListsServiceImplTest.class 2KB
ConvertUtil.class 2KB
UserCartDetailsServiceImplTest.class 2KB
LeaveMessage.class 2KB
UserCart.class 2KB
UsersEquipmentsVo.class 2KB
UserEquipmentsListsServiceImpl.class 2KB
AdministratorController.class 2KB
Users.class 2KB
ImagesController.class 2KB
OrderDetailsController.class 2KB
UsersEquipmentsController.class 2KB
UserCartController.class 2KB
DateUtil.class 2KB
Images.class 1KB
Categories.class 1KB
PhotovoltaicApplicationTests.class 1KB
TestController.class 1KB
EquipmentsService.class 1KB
Administrator.class 1KB
Base64Util.class 1KB
InterceptorConfig.class 942B
DateUtil$1.class 921B
MyRandom.class 902B
UserCartDeatilsService.class 869B
OrdersServiceImplTest.class 866B
PhotovoltaicApplication.class 859B
EquipmentsMapper.class 804B
NoticeService.class 788B
OrdersService.class 685B
StaffsService.class 683B
UsersEquipmentsMapper.class 662B
LeaveMessageService.class 658B
OrdersDetailsMapper.class 625B
Test.class 601B
UserCartDetailsMapper.class 551B
OrdersDetailsService.class 539B
UsersInfoService.class 518B
ImagesService.class 516B
UserService.class 482B
UserEquipmentsService.class 458B
GeneralDao.class 357B
PersonalEquipmentsListsMapper.class 350B
UsersEquipmentsListsMapper.class 341B
AdministratorService.class 336B
PersonalEquipmentsMapper.class 335B
UserEquipmentsListsService.class 335B
PublicInformationMapper.class 332B
AdministratorMapper.class 320B
LeaveMessageMapper.class 317B
CategoriesMapper.class 311B
UsersInfoMapper.class 308B
UserCartMapper.class 305B
UserCartService.class 300B
OrdersMapper.class 299B
ImagesMapper.class 299B
NoticeMapper.class 299B
共 392 条
- 1
- 2
- 3
- 4
资源评论
yava_free
- 粉丝: 2964
- 资源: 1346
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 浙江省、市、区县及街镇可编辑的SVG图
- 2008-2023年上市公司企业(5.6万个样本)耐心资本数据与耐心资本所占比重数据(关系型债务和稳定型股权)-最新出炉.zip
- 哪吒喂养召唤游记投资c2c源码- 宠物养成类社交游戏源码
- 山西省、市、区县及街镇可编辑的SVG图
- 核电站运营和维护服务:预计到2030年将以3.35%的CAGR增长,达到266.5亿美元
- 山东省、市、区县及街镇可编辑的SVG图
- 2001-2023年上市公司企业大数据应用数据、大数据应用指数(6.1万个样本含原始数据+计算代码+计算结果)-最新出炉.zip
- 江苏省、市、区县及街镇可编辑的SVG图
- springboot005-Java沉浸式戏曲文化体验系统.zip
- Flask框架实现登录注册功能(前端+后端)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功