123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- package com.sooka.sponest.data.housingconstruction.controller;
- import com.ruoyi.common.core.web.controller.BaseController;
- import com.ruoyi.common.core.web.domain.AjaxResult;
- import com.ruoyi.common.core.web.page.TableDataInfo;
- import com.ruoyi.common.log.annotation.Log;
- import com.ruoyi.common.log.enums.BusinessType;
- import com.ruoyi.common.security.annotation.RequiresPermissions;
- import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionSteelcylinder;
- import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionSteelcylinderLog;
- import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionSteelcylinderLogService;
- import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionSteelcylinderService;
- import com.sooka.sponest.data.utils.ExcelUtil;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import java.util.List;
- /**
- * 钢瓶日志Controller
- *
- * @author ruoyi
- * @date 2024-07-30
- */
- @RestController
- @RequestMapping("/steelcylinderLog")
- public class CenterdataTHousingconstructionSteelcylinderLogController extends BaseController {
- @Autowired
- private ICenterdataTHousingconstructionSteelcylinderLogService centerdataTHousingconstructionSteelcylinderLogService;
- @Autowired
- private ICenterdataTHousingconstructionSteelcylinderService centerdataTHousingconstructionSteelcylinderService;
- /**
- * 查询钢瓶日志列表
- */
- @RequiresPermissions("data:steelcylinderLog:list")
- @GetMapping("/list")
- public TableDataInfo list(CenterdataTHousingconstructionSteelcylinderLog centerdataTHousingconstructionSteelcylinderLog) {
- startPage();
- List<CenterdataTHousingconstructionSteelcylinderLog> list = centerdataTHousingconstructionSteelcylinderLogService.selectCenterdataTHousingconstructionSteelcylinderLogList(centerdataTHousingconstructionSteelcylinderLog);
- return getDataTable(list);
- }
- /**
- * 导出钢瓶日志列表
- */
- @RequiresPermissions("data:steelcylinderLog:export")
- @Log(title = "钢瓶日志", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, CenterdataTHousingconstructionSteelcylinderLog centerdataTHousingconstructionSteelcylinderLog) {
- List<CenterdataTHousingconstructionSteelcylinderLog> list = centerdataTHousingconstructionSteelcylinderLogService.selectCenterdataTHousingconstructionSteelcylinderLogList(centerdataTHousingconstructionSteelcylinderLog);
- ExcelUtil<CenterdataTHousingconstructionSteelcylinderLog> util = new ExcelUtil<CenterdataTHousingconstructionSteelcylinderLog>(CenterdataTHousingconstructionSteelcylinderLog.class);
- util.exportExcel(response, list, "钢瓶日志数据");
- }
- /**
- * 获取钢瓶日志详细信息
- */
- @RequiresPermissions("data:steelcylinderLog:query")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") String id) {
- return AjaxResult.success(centerdataTHousingconstructionSteelcylinderLogService.selectCenterdataTHousingconstructionSteelcylinderLogById(id));
- }
- /*
- * 按钢瓶id查询最新日志
- *
- * @author 韩福成
- * @date 2024/8/1 上午11:10
- */
- @GetMapping(value = "getSteelcylinderLog/{steelcylinderId}")
- public AjaxResult getSteelcylinderLog(@PathVariable("steelcylinderId") String steelcylinderId) {
- return AjaxResult.success(centerdataTHousingconstructionSteelcylinderLogService.selectBySteelcylinderId(steelcylinderId));
- }
- /*
- * 添加钢瓶流转信息
- *
- * @author 韩福成
- * @date 2024/7/31 下午5:21
- */
- @PostMapping(value = "/addLog")
- public AjaxResult addLog(@RequestBody CenterdataTHousingconstructionSteelcylinderLog centerdataTHousingconstructionSteelcylinderLog) {
- CenterdataTHousingconstructionSteelcylinder steelcylinder = centerdataTHousingconstructionSteelcylinderService.selectCenterdataTHousingconstructionSteelcylinderById(centerdataTHousingconstructionSteelcylinderLog.getSteelcylinderId());
- //修改钢瓶状态
- CenterdataTHousingconstructionSteelcylinder centerdataTHousingconstructionSteelcylinder = new CenterdataTHousingconstructionSteelcylinder();
- centerdataTHousingconstructionSteelcylinder.setId(centerdataTHousingconstructionSteelcylinderLog.getSteelcylinderId());
- centerdataTHousingconstructionSteelcylinder.setState(centerdataTHousingconstructionSteelcylinderLog.getState());
- centerdataTHousingconstructionSteelcylinderService.updateCenterdataTHousingconstructionSteelcylinder(centerdataTHousingconstructionSteelcylinder);
- //按钢瓶id查询最新日志
- CenterdataTHousingconstructionSteelcylinderLog log = centerdataTHousingconstructionSteelcylinderLogService.selectBySteelcylinderId(centerdataTHousingconstructionSteelcylinderLog.getSteelcylinderId());
- if (log ==null){
- return toAjax(centerdataTHousingconstructionSteelcylinderLogService.insertCenterdataTHousingconstructionSteelcylinderLog(centerdataTHousingconstructionSteelcylinderLog));
- }else {
- if (steelcylinder.getState().equals("state_5")&¢erdataTHousingconstructionSteelcylinderLog.getState().equals("state_2")){
- centerdataTHousingconstructionSteelcylinderLog.setJoinWarehouseTime(log.getJoinWarehouseTime());
- return toAjax(centerdataTHousingconstructionSteelcylinderLogService.insertCenterdataTHousingconstructionSteelcylinderLog(centerdataTHousingconstructionSteelcylinderLog));
- }else {
- centerdataTHousingconstructionSteelcylinderLog.setId(log.getId());
- return toAjax(centerdataTHousingconstructionSteelcylinderLogService.updateCenterdataTHousingconstructionSteelcylinderLog(centerdataTHousingconstructionSteelcylinderLog));
- }
- }
- }
- }
|