123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- package com.hssx.cloudmodel.controller;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.hssx.cloudmodel.entity.Company;
- import com.hssx.cloudmodel.entity.User;
- import com.hssx.cloudmodel.entity.vo.CompanyVO;
- import com.hssx.cloudmodel.entity.vo.UserVO;
- import com.hssx.cloudmodel.service.CompanyService;
- import com.hssx.cloudmodel.util.HttpRespMsg;
- import com.hssx.cloudmodel.util.PageUtil;
- import io.swagger.annotations.ApiOperation;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.util.List;
- /**
- * @author 吴涛涛
- * @since 2019-07-26
- */
- @Controller
- @RequestMapping("/company")
- @Slf4j
- public class CompanyController {
- @Autowired
- private CompanyService companyService;
- /**
- * 添加/修改公司
- *
- * 参数:companyName 公司名 companyAddress 公司地址 companyIds 关联公司的ids "1,2,3"
- * companyType公司类型 0-资产方 1-生产方(yLng 经度 xLat 纬度)
- * flag 0-添加,1-修改
- * @return
- */
- @ApiOperation("添加/修改公司")
- @RequestMapping("/add")
- @ResponseBody
- public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, HttpServletRequest request, Integer flag,
- HttpServletResponse response,@RequestParam(required = false) String companyIds) {
- HttpRespMsg msg = new HttpRespMsg();
- msg = companyService.addAndUpdateRole(companyVO, flag,companyIds);
- return msg;
- }
- /**
- * 删除公司
- *
- * @param company 参数 id 公司id
- * @return
- */
- @ApiOperation("删除公司")
- @RequestMapping("/delete")
- @ResponseBody
- public HttpRespMsg delete(Company company, HttpServletRequest request,
- HttpServletResponse response) {
- HttpRespMsg msg = new HttpRespMsg();
- msg = companyService.deleteById(company.getId());
- return msg;
- }
- /**
- * 公司列表
- * 参数:pageNum 当前页码,pageSize 每页条数 keyName 关键字查询,companyType 公司类型 0-资产方 1-生产方
- * @return
- */
- @ApiOperation("公司列表")
- @RequestMapping("/list")
- @ResponseBody
- public HttpRespMsg deleteRole(@RequestParam(required = false)String keyName, HttpServletRequest request,
- HttpServletResponse response, PageUtil page,@RequestParam(required = false)Integer companyType) {
- HttpRespMsg msg = new HttpRespMsg();
- msg = companyService.pageList(page,keyName,companyType);
- return msg;
- }
- /**
- * 建立关联公司时的公司列表
- * 参数:companyType 公司类型 0-资产方 1-生产方
- * @return
- */
- @ApiOperation("建立关联公司时的公司列表")
- @RequestMapping("/relationList")
- @ResponseBody
- public HttpRespMsg relationList(@RequestParam(required = false)Integer companyType) {
- HttpRespMsg msg = new HttpRespMsg();
- msg = companyService.relationList(companyType);
- return msg;
- }
- /**
- * 创建模具获取的(资产方)公司列表
- * @return
- */
- @ApiOperation("创建模具获取的公司列表")
- @RequestMapping("/getCompanys")
- @ResponseBody
- public HttpRespMsg getCompanys() {
- HttpRespMsg msg = new HttpRespMsg();
- QueryWrapper<Company> qw = new QueryWrapper<>();
- qw.eq("company_type",0);
- msg.data = companyService.list(qw);
- return msg;
- }
- /**
- * 创建账号是所获取的公司列表
- * parentId 当前用户的上级id id 当前用户id
- * @return
- */
- @ApiOperation(value = "获取公司列表")
- @RequestMapping("/getCompanyList")
- @ResponseBody
- public HttpRespMsg getCompanyList(User user){
- HttpRespMsg msg = new HttpRespMsg();
- List<Company> list = companyService.getIdAndNamelist(user);
- msg.data = list;
- return msg;
- }
- /**
- * 项目分配生产方公司列表
- * @return
- */
- @ApiOperation(value = "项目分配生产方公司列表")
- @RequestMapping("/addCompanyListToProject")
- @ResponseBody
- public HttpRespMsg addCompanyListToProject(User user){
- HttpRespMsg msg = new HttpRespMsg();
- List<Company> list = companyService.addCompanyListToProject(user);
- msg.data = list;
- return msg;
- }
- /**
- * 生产方公司和公司下所属的模具
- * 参数 token 用户身份凭证
- * @return
- */
- @ApiOperation(value = "生产方公司和公司下所属的模具")
- @RequestMapping("/getCoutomCompanyAndMouldsByUser")
- @ResponseBody
- public HttpRespMsg getCoutomCompanyAndMouldsByUser(UserVO userVO){
- HttpRespMsg msg = new HttpRespMsg();
- msg = companyService.getCoutomCompanyAndMouldsByUser(userVO);
- return msg;
- }
- /**
- * 公司详情
- * 参数 token 用户身份凭证 companyId 公司id
- * @return
- */
- @ApiOperation(value = "公司详情")
- @RequestMapping("/detail")
- @ResponseBody
- public HttpRespMsg detail(UserVO userVO){
- HttpRespMsg msg = new HttpRespMsg();
- msg = companyService.detail(userVO);
- return msg;
- }
- }
|