主题整合月计划
This commit is contained in:
@ -1,7 +1,12 @@
|
||||
package com.ruoyi.project.benyi.controller;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.project.common.SchoolCommon;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -32,6 +37,8 @@ import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
public class ByThemeMonthplanController extends BaseController {
|
||||
@Autowired
|
||||
private IByThemeMonthplanService byThemeMonthplanService;
|
||||
@Autowired
|
||||
private SchoolCommon schoolCommon;
|
||||
|
||||
/**
|
||||
* 查询主题整合月计划列表
|
||||
@ -72,7 +79,29 @@ public class ByThemeMonthplanController extends BaseController {
|
||||
@Log(title = "主题整合月计划", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ByThemeMonthplan byThemeMonthplan) {
|
||||
return toAjax(byThemeMonthplanService.insertByThemeMonthplan(byThemeMonthplan));
|
||||
//首先判断当前账户是否为幼儿园账号
|
||||
if (schoolCommon.isSchool()) {
|
||||
|
||||
byThemeMonthplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||
|
||||
String dateTime = byThemeMonthplan.getMonth();
|
||||
dateTime = dateTime .replace("Z", " UTC"); //2019-06-27T16:00:00.000 UTC
|
||||
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");//转换时区格式
|
||||
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM");
|
||||
Date date = null;//将Z时间格式转换成Date类型格式或换成毫秒
|
||||
try {
|
||||
date = format1.parse(dateTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String time= format2.format(date);//2019-06
|
||||
System.out.println(time);
|
||||
byThemeMonthplan.setMonth(time);
|
||||
byThemeMonthplan.setName(byThemeMonthplan.getName() + "-主题整合月计划(" + byThemeMonthplan.getMonth() + ")");
|
||||
return toAjax(byThemeMonthplanService.insertByThemeMonthplan(byThemeMonthplan));
|
||||
} else {
|
||||
return AjaxResult.error("当前用户非幼儿园,无法添加幼儿");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user