| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | List<DriverActivityHistory> historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",1).eq("activityId",driverActivityRegistered.getId()).eq("carryOut",2)); |
| | | Double totalMOney=0d; |
| | | Double money=0d; |
| | | Integer number=0; |
| | | Integer number=historyList.stream().map(DriverActivityHistory::getDriverId).collect(Collectors.toSet()).size(); |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money1",money); |
| | | map.put("number1",number); |
| | |
| | | //统计邀请用户注册 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",2).eq("activityId",driverActivityRegistered.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | number=historyList.stream().map(DriverActivityHistory::getDriverId).collect(Collectors.toSet()).size(); |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money2",money); |
| | | map.put("number2",number); |
| | |
| | | //统计专车在线 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",3).eq("activityId",driverActivityOnline.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | number=historyList.stream().map(DriverActivityHistory::getDriverId).collect(Collectors.toSet()).size(); |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money3",money); |
| | | map.put("number3",number); |
| | |
| | | //统计订单数 |
| | | historyList = driverActivityHistoryService.selectList(new EntityWrapper<DriverActivityHistory>().between("insertTime",startTimes,endTimes).eq("type",4).eq("activityId",driverActivityOrder.getId()).eq("carryOut",2)); |
| | | money=0d; |
| | | number=0; |
| | | number=historyList.stream().map(DriverActivityHistory::getDriverId).collect(Collectors.toSet()).size(); |
| | | for(DriverActivityHistory history:historyList){ |
| | | totalMOney+=history.getMoney(); |
| | | money+=history.getMoney(); |
| | | number+=1; |
| | | } |
| | | map.put("money6",money); |
| | | map.put("number6",number); |
| | |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Integer companyType = null; |
| | | Integer companyId = null; |
| | | if(1 != user.getRoleType()){ |
| | | companyType = user.getRoleType(); |
| | | companyId = user.getObjectId(); |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(driverActivityService.getList(page,beginTime,endTime,name,user.getRoleType(),user.getObjectId())); |
| | | page.setRecords(driverActivityService.getList(page,beginTime,endTime,name,companyType,companyId)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Object add(String staTime, String startTime, String num1, Double num2 |
| | | , Double num3 |
| | | , Integer num4 |
| | | , String num4 |
| | | , Double num5 |
| | | , Integer num6 |
| | | , Double num7 |
| | |
| | | @ResponseBody |
| | | public Object update(Integer id,String staTime, String startTime, String num1, Double num2 |
| | | , Double num3 |
| | | , Integer num4 |
| | | , String num4 |
| | | , Double num5 |
| | | , Integer num6 |
| | | , Double num7 |
| | |
| | | @RequestMapping(value = "/updateStatus") |
| | | @ResponseBody |
| | | public Object updateStatus(DriverActivity driverActivity) { |
| | | DriverActivity driverActivity1 = driverActivityService.selectById(driverActivity.getId()); |
| | | if(System.currentTimeMillis() >= driverActivity1.getEndTime().getTime()){ |
| | | return ResultUtil.error("活动已结束,修改状态失败"); |
| | | } |
| | | driverActivityService.updateById(driverActivity); |
| | | return SUCCESS_TIP; |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @RequestMapping("/driverActivity_detail/{driverActivityId}") |