You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

272 lines
9.0 KiB

/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.excel.CustomerStaffExcel;
import com.epmet.service.CustomerStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 政府工作人员表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-04-18
*/
@RestController
@RequestMapping("customerstaff")
public class CustomerStaffController {
@Autowired
private CustomerStaffService customerStaffService;
@GetMapping("page")
public Result<PageData<CustomerStaffDTO>> page(@RequestParam Map<String, Object> params) {
PageData<CustomerStaffDTO> page = customerStaffService.page(params);
return new Result<PageData<CustomerStaffDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<CustomerStaffDTO> get(@PathVariable("id") String id) {
CustomerStaffDTO data = customerStaffService.get(id);
return new Result<CustomerStaffDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody CustomerStaffDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
customerStaffService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody CustomerStaffDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
customerStaffService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
customerStaffService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<CustomerStaffDTO> list = customerStaffService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffExcel.class);
}
5 years ago
/**
* @param mobile 手机号
5 years ago
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息校验用户是否存在
* @Date 2020/4/18 14:07
**/
@GetMapping(value = "getcustsomerstaffbyphone/{mobile}")
public Result<List<CustomerStaffDTO>> getCustsomerStaffByPhone(@PathVariable("mobile") String mobile) {
return customerStaffService.getCustsomerStaffByPhone(mobile);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerStaffDTO>
* @Author yinzuomei
* @Description 根据手机号+客户id获取工作人员基本信息
* @Date 2020/4/20 14:04
**/
@PostMapping(value = "getcustomerstaffinfo")
public Result<CustomerStaffDTO> getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return customerStaffService.getCustomerStaffInfo(formDTO);
5 years ago
}
/**
* 根据userId查询网格下用户信息
* @param customerStaffGridDTOS
* @return
*/
@PostMapping(value = "selectstaffgridlistbyuserid")
public Result<List<StaffGridListDTO>> selectStaffGridListByUserId(@RequestBody List<UserIdAndPidDTO> customerStaffGridDTOS){
Result<List<StaffGridListDTO>> listResult = customerStaffService.selectStaffGridListByUserId(customerStaffGridDTOS);
return listResult;
}
/**
* 根据用户ID获取工作人员基本信息
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerStaffDTO>
* @author zhaoqifeng
* @date 2020/4/22 10:05
**/
@PostMapping(value = "getstaffinfobyuserid")
public Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(@RequestBody CustomerStaffDTO formDTO) {
return customerStaffService.getCustomerStaffInfoByUserId(formDTO);
}
/**
* 组织首页-工作人员列表
* @param fromDTO
* @return
*/
@PostMapping("staffsinagency")
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffInfoForHome(fromDTO);
}
/**
* 工作人员列表
* @param fromDTO
* @return
*/
@PostMapping("stafflist")
public Result<List<StaffInfoResultDTO>> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffList(fromDTO);
}
/**
* 查询网格下未被禁用人员
* @param userIdDTO
* @auther zxc
*/
@PostMapping(value = "selectgridstaffcountbyuserid")
public Result<GridStaffCountDTO> selectGridStaffCountByUserId(@RequestBody List<UserIdDTO> userIdDTO){
return customerStaffService.selectGridStaffCountByUserId(userIdDTO);
}
/**
* 人员添加页面初始化
*
* @param fromDTO 参数
* @return Result<StaffInitResultDTO>
*/
@PostMapping("rolelist")
public Result<List<RoleInfoResultDTO>> addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.addStaffInit(fromDTO);
}
/**
* 人员编辑页面初始化
*
* @param fromDTO 参数
* @return Result<StaffInitResultDTO>
*/
@PostMapping("editstaffinit")
public Result<StaffInitResultDTO> editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.editStaffInit(fromDTO);
}
/**
* 人员添加
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("addstaff")
public Result<CustomerStaffDTO> addStaff(@RequestBody StaffSubmitFromDTO fromDTO){
return customerStaffService.addStaff(fromDTO);
}
/**
* 人员编辑
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("editstaff")
public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){
return customerStaffService.editStaff(fromDTO);
}
/**
* 人员详情
*
* @param fromDTO 参数
* @return Result<StaffDetailResultDTO>
*/
@PostMapping("staffdetail")
public Result<StaffDetailResultDTO> getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.getStaffDetail(fromDTO);
}
/**
* 人员禁用
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("disabledstaff")
public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){
return customerStaffService.disabledStaff(fromDTO);
}
/**
* @param fromDTO
* @return
* @Author sun
* @Description 根据客户Id及userId集合查询用户基本信息
*/
@PostMapping("getdepartmentstafflist")
public Result<List<DepartInStaffListResultDTO>> getDepartmentStaffList(@RequestBody DepartmentInStaffFormDTO fromDTO) {
return customerStaffService.getDepartmentStaffList(fromDTO);
}
Merge remote-tracking branch 'origin/dev_govorg' into dev_govorg # Conflicts: # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java # epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java # epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml # epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java # epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java # epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
5 years ago
/**
* @Description 通过userId列表查询未被禁用的用户信息
* @Param CommonUserIdListFormDTO :: getUserIdList
* @return Result<List<CommonStaffInfoResultDTO>>
* @Author wangc
* @Date 2020.04.24 15:44
**/
@PostMapping(value = "enabestaffmsglist")
public Result<List<CommonStaffInfoResultDTO>> enableStaffMsgList(@RequestBody CommonUserIdListFormDTO userIdList){
ValidatorUtils.validateEntity(userIdList);
return customerStaffService.getEnableStaffMsgList(userIdList);
}
}