package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSON; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.model.RmsPersonnel; import com.steerinfo.dil.service.impl.RmsPersonnelServiceImpl; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * RmsPersonnel RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-11-06 02:47 * 类描述 * 修订历史: * 日期:2021-11-06 * 作者:hujiehuan * 参考: * 描述:RmsPersonnel RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/rmspersonnel") public class RmsPersonnelController extends BaseRESTfulController { @Autowired RmsPersonnelServiceImpl rmsPersonnelService; @Autowired ColumnDataUtil columnDataUtil; @Autowired ESFeign esFeign; /** * 展示人员信息 * @param mapValue * @param pageNum * @param pageSize * @param apiId * @return */ @ApiOperation(value="展示人员信息", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "341", required = false, dataType = "BigDecimal"), }) //@RequiresPermissions("rmspersonnel:view") @PostMapping(value = "/getPersonnelList") public RESTfulResult getPersonnelList(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String con){ PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = rmsPersonnelService.getPersonnelList(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId,null,columnList); return success(data); } /** * 添加人员信息 * @param map * @return */ @ApiOperation(value="创建", notes="根据RmsPersonnel对象创建") @ApiImplicitParam(name = "rmsPersonnel", value = "详细实体rmsPersonnel", required = false, dataType = "RmsPersonnel") @PostMapping(value = "/insertPersonnel") public RESTfulResult insertPersonnel(@RequestBody(required = false) Map map){ int result=rmsPersonnelService.insertPersonnel(map); if (result <= 0){ return failed(); } return success(result); } /** * 更新人员信息 * @param rmsPersonnel * @return */ @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的rmsPersonnel信息来更新详细信息") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"), @ApiImplicitParam(name = "rmsPersonnel", value = "详细实体rmsPersonnel", required = true, dataType = "RmsPersonnel") }) @PostMapping(value = "/updatePersonnel", produces = "application/json;charset=UTF-8") public RESTfulResult updatePersonnel(@RequestBody RmsPersonnel rmsPersonnel){ int result=rmsPersonnelService.updatePersonnel(rmsPersonnel); return success(result); } /** * 删除人员信息 * @param id * @return */ @ApiOperation(value="删除", notes="根据url的id来指定删除对象") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") //@RequiresPermissions("rmspersonnel:delete") @PostMapping(value = "/deletePersonnel/{id}")//BigDecimal public RESTfulResult deletePeronnel(@PathVariable ("id") BigDecimal id ){ return success(rmsPersonnelService.deletePersonnel(id)); } /**根据id值详细获取人员信息 * */ @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @PostMapping(value = "/getPersonnelById/{id}") public RESTfulResult getPersonnelById(@PathVariable("id") BigDecimal id){ List> list= rmsPersonnelService.getPersonnelById(id); System.out.println(list); return success(list); } /** * 下拉框获得托运人信息 */ @GetMapping("/getShipperId") public RESTfulResult getShipperId(){ return success(rmsPersonnelService.getShipperId()); } /** * 得到二级部门的下拉 * @return */ @GetMapping("/getSecondShipper") public RESTfulResult getSecondShipper() { return success(rmsPersonnelService.getSecondShipper()); } /** * 得到三级部门的下拉 * @return */ @GetMapping("/getThirdShipper") public RESTfulResult getThirdShipper(@RequestParam Integer shipperId) { return success(rmsPersonnelService.getThirdShipper(new BigDecimal(shipperId))); } /** * 查询SSO主键和机构编码 * @return */ @PostMapping("/getShipperMap") public RESTfulResult getShipperMap(@RequestParam Integer shipperId) { return success(rmsPersonnelService.getShipperMap(new BigDecimal(shipperId))); } @PostMapping("/isInHere") public Integer isInHere(@RequestParam String personnelJobNumber) { Integer result = rmsPersonnelService.isInHere(personnelJobNumber); if (result != null && result.toString().length() != 0) { return 0; } else { return -1; } } /** * 新增人员权限 * @param map * @return */ @ApiOperation(value="创建", notes="RmsPersonnel对象创建") @PostMapping(value = "/addPersonnel") public RESTfulResult addPersonnel(@RequestBody(required = false) Map map){ int result = rmsPersonnelService.addPersonnel(map); if (result <= 0){ return failed(); } return success(result); } }