| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.eam.entity.EamTechnicalStatusChangeDetail; |
| | | import org.jeecg.modules.eam.service.IEamTechnicalStatusChangeDetailService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | /** |
| | | * @Description: 技术状态变更申请明细 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-09 |
| | | * @Date: 2025-07-09 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags="技术状态变更申请明细") |
| | | @Api(tags = "技术状态变更申请明细") |
| | | @RestController |
| | | @RequestMapping("/eam/eamTechnicalStatusChangeDetail") |
| | | public class EamTechnicalStatusChangeDetailController extends JeecgController<EamTechnicalStatusChangeDetail, IEamTechnicalStatusChangeDetailService> { |
| | | @Autowired |
| | | private IEamTechnicalStatusChangeDetailService eamTechnicalStatusChangeDetailService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param eamTechnicalStatusChangeDetail |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="技术状态变更申请明细-分页列表查询", notes="技术状态变更申请明细-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamTechnicalStatusChangeDetail eamTechnicalStatusChangeDetail, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EamTechnicalStatusChangeDetail> queryWrapper = QueryGenerator.initQueryWrapper(eamTechnicalStatusChangeDetail, req.getParameterMap()); |
| | | Page<EamTechnicalStatusChangeDetail> page = new Page<EamTechnicalStatusChangeDetail>(pageNo, pageSize); |
| | | IPage<EamTechnicalStatusChangeDetail> pageList = eamTechnicalStatusChangeDetailService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param eamTechnicalStatusChangeDetail |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "技术状态变更申请明细-添加") |
| | | @ApiOperation(value="技术状态变更申请明细-添加", notes="技术状态变更申请明细-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamTechnicalStatusChangeDetail eamTechnicalStatusChangeDetail) { |
| | | eamTechnicalStatusChangeDetailService.save(eamTechnicalStatusChangeDetail); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param eamTechnicalStatusChangeDetail |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "技术状态变更申请明细-编辑") |
| | | @ApiOperation(value="技术状态变更申请明细-编辑", notes="技术状态变更申请明细-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamTechnicalStatusChangeDetail eamTechnicalStatusChangeDetail) { |
| | | eamTechnicalStatusChangeDetailService.updateById(eamTechnicalStatusChangeDetail); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "技术状态变更申请明细-通过id删除") |
| | | @ApiOperation(value="技术状态变更申请明细-通过id删除", notes="技术状态变更申请明细-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
| | | eamTechnicalStatusChangeDetailService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "技术状态变更申请明细-批量删除") |
| | | @ApiOperation(value="技术状态变更申请明细-批量删除", notes="技术状态变更申请明细-批量删除") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.eamTechnicalStatusChangeDetailService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "技术状态变更申请明细-通过id查询") |
| | | @ApiOperation(value="技术状态变更申请明细-通过id查询", notes="技术状态变更申请明细-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
| | | EamTechnicalStatusChangeDetail eamTechnicalStatusChangeDetail = eamTechnicalStatusChangeDetailService.getById(id); |
| | | return Result.OK(eamTechnicalStatusChangeDetail); |
| | | } |
| | | @Autowired |
| | | private IEamTechnicalStatusChangeDetailService orderDetailService; |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | @Autowired |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param eamTechnicalStatusChangeDetail |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamTechnicalStatusChangeDetail eamTechnicalStatusChangeDetail) { |
| | | return super.exportXls(request, eamTechnicalStatusChangeDetail, EamTechnicalStatusChangeDetail.class, "技术状态变更申请明细"); |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EamTechnicalStatusChangeDetail.class); |
| | | } |
| | | |
| | | /** |
| | | * 一次加载 |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "技术状态变更申请明细-不分页列表查询", notes = "技术状态变更申请明细-不分页列表查询") |
| | | @GetMapping(value = "/queryList") |
| | | public Result<?> queryList(@RequestParam("orderId") String orderId) { |
| | | List<EamTechnicalStatusChangeDetail> list = orderDetailService.queryList(orderId); |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | try { |
| | | for(EamTechnicalStatusChangeDetail vo : list) { |
| | | String json = objectMapper.writeValueAsString(vo); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("acceptanceChecker", vo.getAcceptanceChecker(), item, "sys_user,realname,username"); |
| | | translateDictTextUtils.translateField("changeCategory", vo.getChangeCategory(), item, "technical_status_change_reason"); |
| | | translateDictTextUtils.translateField("changeTechnicalStatus", vo.getChangeTechnicalStatus(), item, "equipment_technology_status"); |
| | | translateDictTextUtils.translateField("acceptanceCheckResult", vo.getAcceptanceCheckResult(), item, "equipment_technology_status"); |
| | | items.add(item); |
| | | } |
| | | return Result.OK(items); |
| | | }catch (Exception e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | | } |