Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop

This commit is contained in:
huangdeliang
2021-05-18 14:03:40 +08:00
29 changed files with 1043 additions and 24 deletions

View File

@ -0,0 +1,103 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.custom.domain.SysImportFanRecord;
import com.stdiet.custom.service.ISysImportFanRecordService;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
/**
* 导粉管理Controller
*
* @author xzj
* @date 2021-05-17
*/
@RestController
@RequestMapping("/custom/importFanRecord")
public class SysImportFanRecordController extends BaseController
{
@Autowired
private ISysImportFanRecordService sysImportFanRecordService;
/**
* 查询导粉管理列表
*/
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:list')")
@GetMapping("/list")
public TableDataInfo list(SysImportFanRecord sysImportFanRecord)
{
startPage();
List<SysImportFanRecord> list = sysImportFanRecordService.selectSysImportFanRecordList(sysImportFanRecord);
return getDataTable(list);
}
/**
* 导出导粉管理列表
*/
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:export')")
@Log(title = "导粉管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysImportFanRecord sysImportFanRecord)
{
List<SysImportFanRecord> list = sysImportFanRecordService.selectSysImportFanRecordList(sysImportFanRecord);
ExcelUtil<SysImportFanRecord> util = new ExcelUtil<SysImportFanRecord>(SysImportFanRecord.class);
return util.exportExcel(list, "importFanRecord");
}
/**
* 获取导粉管理详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysImportFanRecordService.selectSysImportFanRecordById(id));
}
/**
* 新增导粉管理
*/
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:add')")
@Log(title = "导粉管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysImportFanRecord sysImportFanRecord)
{
return toAjax(sysImportFanRecordService.insertSysImportFanRecord(sysImportFanRecord));
}
/**
* 修改导粉管理
*/
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:edit')")
@Log(title = "导粉管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysImportFanRecord sysImportFanRecord)
{
return toAjax(sysImportFanRecordService.updateSysImportFanRecord(sysImportFanRecord));
}
/**
* 删除导粉管理
*/
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:remove')")
@Log(title = "导粉管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysImportFanRecordService.deleteSysImportFanRecordByIds(ids));
}
}

View File

@ -2,6 +2,8 @@ package com.stdiet.web.controller.custom;
import java.util.Date;
import java.util.List;
import com.stdiet.common.utils.DateUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -84,7 +86,12 @@ public class SysLiveSchedulController extends BaseController
//下播,补全下播时间
if (sysLiveSchedul.getLiveStatus() != null && sysLiveSchedul.getLiveStatus().longValue() == 2
&& sysLiveSchedul.getLiveEndTime() == null){
sysLiveSchedul.setLiveEndTime(new Date());
Date now = new Date();
if(!DateUtils.isSameDay(now,sysLiveSchedul.getLiveStartTime())){
sysLiveSchedul.setLiveEndTime(DateUtils.getLastMinuteDate(sysLiveSchedul.getLiveStartTime()));
}else{
sysLiveSchedul.setLiveEndTime(now);
}
}
int row = sysLiveSchedulService.insertSysLiveSchedul(sysLiveSchedul);
if(row > 0){
@ -96,7 +103,11 @@ public class SysLiveSchedulController extends BaseController
if(lastLiveSchedul != null && lastLiveSchedul.getLiveStatus().longValue() == 1){
lastLiveSchedul.setLiveStatus(2L);
if(lastLiveSchedul.getLiveEndTime() == null){
lastLiveSchedul.setLiveEndTime(sysLiveSchedul.getLiveStartTime());
if(!DateUtils.isSameDay(lastLiveSchedul.getLiveStartTime(),sysLiveSchedul.getLiveStartTime())){
lastLiveSchedul.setLiveEndTime(DateUtils.getLastMinuteDate(lastLiveSchedul.getLiveStartTime()));
}else{
lastLiveSchedul.setLiveEndTime(sysLiveSchedul.getLiveStartTime());
}
}
row = sysLiveSchedulService.updateSysLiveSchedul(lastLiveSchedul);
}
@ -121,7 +132,12 @@ public class SysLiveSchedulController extends BaseController
//下播,补全下播时间
if (sysLiveSchedul.getLiveStatus() != null && sysLiveSchedul.getLiveStatus().longValue() == 2
&& sysLiveSchedul.getLiveEndTime() == null){
sysLiveSchedul.setLiveEndTime(new Date());
Date now = new Date();
if(!DateUtils.isSameDay(now,sysLiveSchedul.getLiveStartTime())){
sysLiveSchedul.setLiveEndTime(DateUtils.getLastMinuteDate(sysLiveSchedul.getLiveStartTime()));
}else{
sysLiveSchedul.setLiveEndTime(now);
}
}
int row = sysLiveSchedulService.updateSysLiveSchedulById(sysLiveSchedul);
if(row > 0){
@ -133,7 +149,11 @@ public class SysLiveSchedulController extends BaseController
if(lastLiveSchedul != null && lastLiveSchedul.getLiveStatus().longValue() == 1){
lastLiveSchedul.setLiveStatus(2L);
if(lastLiveSchedul.getLiveEndTime() == null){
lastLiveSchedul.setLiveEndTime(sysLiveSchedul.getLiveStartTime());
if(!DateUtils.isSameDay(lastLiveSchedul.getLiveStartTime(),sysLiveSchedul.getLiveStartTime())){
lastLiveSchedul.setLiveEndTime(DateUtils.getLastMinuteDate(lastLiveSchedul.getLiveStartTime()));
}else{
lastLiveSchedul.setLiveEndTime(sysLiveSchedul.getLiveStartTime());
}
}
row = sysLiveSchedulService.updateSysLiveSchedul(lastLiveSchedul);
}
@ -178,7 +198,11 @@ public class SysLiveSchedulController extends BaseController
if(lastLiveSchedul != null && lastLiveSchedul.getLiveStatus().longValue() == 1){
lastLiveSchedul.setLiveStatus(2L);
if(lastLiveSchedul.getLiveEndTime() == null){
lastLiveSchedul.setLiveEndTime(sysLiveSchedul.getLiveStartTime());
if(!DateUtils.isSameDay(lastLiveSchedul.getLiveStartTime(),sysLiveSchedul.getLiveStartTime())){
lastLiveSchedul.setLiveEndTime(DateUtils.getLastMinuteDate(lastLiveSchedul.getLiveStartTime()));
}else{
lastLiveSchedul.setLiveEndTime(sysLiveSchedul.getLiveStartTime());
}
}
row = sysLiveSchedulService.updateSysLiveSchedul(lastLiveSchedul);
}
@ -188,10 +212,25 @@ public class SysLiveSchedulController extends BaseController
}else{
SysLiveSchedul newLiveSchedul = sysLiveSchedulService.selectSysLiveSchedulById(sysLiveSchedul.getId());
if(newLiveSchedul != null && newLiveSchedul.getLiveEndTime() == null){
sysLiveSchedul.setLiveEndTime(new Date());
Date now = new Date();
if(!DateUtils.isSameDay(now,newLiveSchedul.getLiveStartTime())){
sysLiveSchedul.setLiveEndTime(DateUtils.getLastMinuteDate(newLiveSchedul.getLiveStartTime()));
}else{
sysLiveSchedul.setLiveEndTime(now);
}
}
row = sysLiveSchedulService.updateSysLiveSchedul(sysLiveSchedul);
}
return toAjax(row);
}
/**
* 复制上次直播记录
*/
@PreAuthorize("@ss.hasPermi('custom:liveSchedul:add')")
@Log(title = "复制上次直播记录", businessType = BusinessType.INSERT)
@GetMapping(value = "/copyLastTimeLiveSchedul")
public AjaxResult copyLastTimeLiveSchedul(){
return sysLiveSchedulService.copyLastTimeLiveSchedul();
}
}