| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | 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.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationOrderChangeStatusEnum; |
| | | import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationOrderChange; |
| | | import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderChangeQuery; |
| | |
| | | import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationOrderChangeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Description: 技术状态鉴定工单变更 |
| | |
| | | public class EamTechnicalStatusEvaluationOrderChangeController extends JeecgController<EamTechnicalStatusEvaluationOrderChange, IEamTechnicalStatusEvaluationOrderChangeService> { |
| | | @Autowired |
| | | private IEamTechnicalStatusEvaluationOrderChangeService eamTechnicalStatusEvaluationOrderChangeService; |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | @Autowired |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | } |
| | | boolean b = eamTechnicalStatusEvaluationOrderChangeService.addTechnicalStatusEvaluationOrderChange(request); |
| | | if (!b) { |
| | | return Result.error("添加失败!"); |
| | | return Result.error("变更失败!"); |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | 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) { |
| | | eamTechnicalStatusEvaluationOrderChangeService.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.eamTechnicalStatusEvaluationOrderChangeService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | |
| | | @ApiOperation(value = "技术状态鉴定工单变更-通过id查询", notes = "技术状态鉴定工单变更-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | EamTechnicalStatusEvaluationOrderChange eamTechnicalStatusEvaluationOrderChange = eamTechnicalStatusEvaluationOrderChangeService.getById(id); |
| | | return Result.OK(eamTechnicalStatusEvaluationOrderChange); |
| | | } |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param eamTechnicalStatusEvaluationOrderChange |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamTechnicalStatusEvaluationOrderChange eamTechnicalStatusEvaluationOrderChange) { |
| | | return super.exportXls(request, eamTechnicalStatusEvaluationOrderChange, EamTechnicalStatusEvaluationOrderChange.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, EamTechnicalStatusEvaluationOrderChange.class); |
| | | EamTechnicalStatusEvaluationOrderChange entity = eamTechnicalStatusEvaluationOrderChangeService.getById(id); |
| | | if (entity == null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | try { |
| | | String json = objectMapper.writeValueAsString(entity); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("orderId", entity.getOrderId(), item, "eam_technical_status_evaluation_order,order_num,id"); |
| | | translateDictTextUtils.translateField("applicant", entity.getApplicant(), item, "sys_user,realname,username"); |
| | | translateDictTextUtils.translateField("factoryOrgCode", entity.getFactoryOrgCode(), item, "eam_base_factory,factory_name,org_code"); |
| | | translateDictTextUtils.translateField("applyReason", entity.getApplyReason(), item, "technical_status_evaluation_order_change_reason"); |
| | | return Result.OK(item); |
| | | } catch (JsonProcessingException e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | | |
| | | } |