| | |
| | | package com.zy.crm.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.crm.manager.entity.ReimburseOnlineDetl; |
| | | import com.zy.crm.manager.entity.Weekly; |
| | | import com.zy.crm.manager.entity.WeeklyDailyPlan; |
| | | import com.zy.crm.manager.entity.param.WeeklyDomainParam; |
| | | import com.zy.crm.manager.service.WeeklyDailyPlanService; |
| | | import com.zy.crm.manager.service.WeeklyService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | |
| | | import com.core.common.R; |
| | | import com.core.domain.KeyValueVo; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import com.zy.crm.manager.utils.TimeCalculatorUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | |
| | | |
| | | @Autowired |
| | | private WeeklyService weeklyService; |
| | | @Autowired |
| | | private WeeklyDailyPlanService weeklyDailyPlanService; |
| | | |
| | | @RequestMapping(value = "/weekly/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weekly/from/add/auth") |
| | | @ManagerAuth(memo = "周计划/日计划/日实际") |
| | | @Transactional |
| | | public R formAdd(@RequestBody WeeklyDomainParam param){ |
| | | try{ |
| | | if (Cools.isEmpty(param)){ |
| | | return R.error("参数为空:WeeklyDomainParam"); |
| | | } else if (Cools.isEmpty(param.getWeeklyDailyPlanList()) || param.getWeeklyDailyPlanList().size()==0){ |
| | | return R.error("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | return R.error("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getType())){ |
| | | return R.error("参数为空:Type"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | return R.error("参数为空:Weekly"); |
| | | } |
| | | Date now = new Date(); |
| | | Weekly weekly = new Weekly(); |
| | | weekly.setHostId(getHostId()); |
| | | weekly.setDeptId(getDeptId()); // 所属部门 |
| | | weekly.setUserId(getUserId()); // 所属人员 |
| | | |
| | | weekly.setCreateBy(getUserId()); |
| | | weekly.setCreateTime(now); |
| | | weekly.setUpdateBy(getUserId()); |
| | | weekly.setUpdateTime(now); |
| | | |
| | | |
| | | List<Date> dateList = new ArrayList<>();//获取周一与周日日期 |
| | | switch (param.getType()){ |
| | | case 1: |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayFront(now); |
| | | weekly.setStatus(2); |
| | | break; |
| | | case 2: |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayNow(now); |
| | | weekly.setStatus(1); |
| | | break; |
| | | case 3: |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayAfter(now); |
| | | weekly.setStatus(0); |
| | | break; |
| | | default: |
| | | return R.error("参数异常:Weekly="+param.getType()); |
| | | } |
| | | List<Date> dates = TimeCalculatorUtils.WeeklyListDays(dateList);//获取周一到周日日期 |
| | | System.out.println(dates.toString()); |
| | | } catch (Exception e){ |
| | | return R.error("异常:"+e); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weekly/detl/all/auth") |
| | | @Transactional |
| | | public R head(@RequestParam Integer weeklyId){ |
| | | List<WeeklyDailyPlan> weeklyDailyPlans = weeklyDailyPlanService.selectList(new EntityWrapper<WeeklyDailyPlan>().eq("weekly_id", weeklyId)); |
| | | return R.ok().add(weeklyDailyPlans); |
| | | } |
| | | } |