|
@@ -1,227 +0,0 @@
|
|
|
-//package com.dragoninfo.dcuc.authweb.restcontroller.app;
|
|
|
-//
|
|
|
-//import cn.hutool.core.bean.BeanUtil;
|
|
|
-//import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
|
-//import com.dragoninfo.dcuc.app.entity.ManufacturerInfo;
|
|
|
-//import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
|
|
|
-//import com.dragoninfo.dcuc.app.facade.IManufacturerInfoFacade;
|
|
|
-//import com.dragoninfo.dcuc.authweb.business.impl.MtAuthBusiness;
|
|
|
-//import com.dragoninfo.dcuc.authweb.common.SysConstants;
|
|
|
-//import com.dragoninfo.dcuc.authweb.restcontroller.app.vo.ManufacturerVo;
|
|
|
-//import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
|
|
|
-//import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
|
|
|
-//import com.dragoninfo.dcuc.user.user.entity.UserInfo;
|
|
|
-//import com.dragoninfo.dcuc.user.user.enumresources.UserTypeEnum;
|
|
|
-//import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
|
|
|
-//import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
|
|
|
-//import com.dragoninfo.duceap.core.enums.ResultEnum;
|
|
|
-//import com.dragoninfo.duceap.core.response.Result;
|
|
|
-//import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
|
|
|
-//import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
-//import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
|
|
|
-//import com.dragonsoft.duceap.core.context.ContextUtils;
|
|
|
-//import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
-//import com.dragonsoft.duceap.web.controller.BaseController;
|
|
|
-//import io.swagger.annotations.Api;
|
|
|
-//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.data.domain.Page;
|
|
|
-//import org.springframework.web.bind.annotation.*;
|
|
|
-//
|
|
|
-//import java.util.*;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @author yica
|
|
|
-// * @date 2018/8/8
|
|
|
-// */
|
|
|
-//@Api(tags = {"厂商管理接口"})
|
|
|
-//@RestController
|
|
|
-//@RequestMapping(value = "/appsvr/v2")
|
|
|
-//public class ManufacturerInfoController extends BaseController<ManufacturerInfo, String> {
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IManufacturerInfoFacade manufacturerInfoFacade;
|
|
|
-// @Autowired
|
|
|
-// private IApplyInfoFacade applyInfoFacade;
|
|
|
-// @Autowired
|
|
|
-// private MtAuthBusiness mtAuthBusiness;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IOrgInfoFacade orgInfoFacade;
|
|
|
-// @Autowired
|
|
|
-// private IUserInfoFacade userInfoFacade;
|
|
|
-//
|
|
|
-// @ApiOperation(value = "厂商查询列表")
|
|
|
-// @ApiImplicitParam(name = "searchable", value = "查询条件")
|
|
|
-// @PostMapping(value = "manufacturers")
|
|
|
-// public Result<List<ManufacturerInfo>> list(SearchDTO searchDTO) {
|
|
|
-// Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
-// Page<ManufacturerInfo> page = manufacturerInfoFacade.manufacturerInfoPage(searchable.toSearchDTO());
|
|
|
-// return Result.success(page.getTotalElements(), page.getContent());
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "获取厂商")
|
|
|
-// @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "厂商ID", required = true
|
|
|
-// , example = "40288a8b699fc2500169a33b20540000")})
|
|
|
-// @GetMapping(value = "manufacturer/{id}")
|
|
|
-// public Result<ManufacturerVo> detail(@PathVariable("id") String id) {
|
|
|
-// ManufacturerVo manufacturerVo = new ManufacturerVo();
|
|
|
-// ManufacturerInfo manufacturerInfo = manufacturerInfoFacade.manufacturerInfoDetail(id);
|
|
|
-// BeanUtil.copyProperties(manufacturerInfo, manufacturerVo);
|
|
|
-// return Result.success(manufacturerVo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "修改厂商")
|
|
|
-// @ApiImplicitParam(name = "manufacturerVo", value = "厂商vo")
|
|
|
-// @PutMapping(value = "/manufacturer/{id}")
|
|
|
-// public Result<Object> update(@RequestBody ManufacturerVo manufacturerVo) {
|
|
|
-// try {
|
|
|
-// String id = manufacturerVo.getId();
|
|
|
-// String manufacturerName = manufacturerVo.getManufacturerName();
|
|
|
-// String code = manufacturerVo.getCode();
|
|
|
-//
|
|
|
-// ManufacturerInfo old = manufacturerInfoFacade.manufacturerInfoDetail(id);
|
|
|
-// String oldManufacturerName = old.getManufacturerName();
|
|
|
-// String oldCode = old.getCode();
|
|
|
-//
|
|
|
-// //厂商名称是否被修改
|
|
|
-// if (!oldManufacturerName.equals(manufacturerName)) {
|
|
|
-// List<ApplyInfo> appList = applyInfoFacade.getAppListByManufacturerId(id);
|
|
|
-// if (null != appList && (!appList.isEmpty())) {
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "厂商已被引用,名称不可修改!");
|
|
|
-// }
|
|
|
-// if (isManufacturerName(manufacturerVo.getManufacturerName())) {
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "厂商名称已被创建");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (!code.equals(oldCode) && isCodeExist(code)) {
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "组织机构代码已存在");
|
|
|
-// }
|
|
|
-// BeanUtil.copyProperties(manufacturerVo, old);
|
|
|
-// manufacturerInfoFacade.updateManufacturer(old);
|
|
|
-// } catch (Exception e) {
|
|
|
-// logger.error("manufacturer update", e);
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "保存异常");
|
|
|
-// }
|
|
|
-// return Result.success();
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "保存厂商")
|
|
|
-// @ApiImplicitParam(name = "manufacturerVo", value = "厂商vo")
|
|
|
-// @PostMapping(value = "/manufacturer")
|
|
|
-// public Result<Object> save(@RequestBody ManufacturerVo manufacturerVo) {
|
|
|
-// try {
|
|
|
-// if (isManufacturerName(manufacturerVo.getManufacturerName())) {
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "厂商名称已被创建");
|
|
|
-// }
|
|
|
-// if (isCodeExist(manufacturerVo.getCode())) {
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "组织机构代码已存在");
|
|
|
-// }
|
|
|
-// ManufacturerInfo manufacturerInfo = new ManufacturerInfo();
|
|
|
-// BeanUtil.copyProperties(manufacturerVo, manufacturerInfo);
|
|
|
-//
|
|
|
-// manufacturerInfoFacade.saveManufacturer(manufacturerInfo);
|
|
|
-// } catch (Exception e) {
|
|
|
-// logger.error(e.getMessage(), e);
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "保存异常");
|
|
|
-// }
|
|
|
-// return Result.success();
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "删除厂商")
|
|
|
-// @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "厂商ID", required = true
|
|
|
-// , example = "40288a8b699fc2500169a33b20540000")})
|
|
|
-// @DeleteMapping(value = "manufacturer/{id}")
|
|
|
-// public Result<Object> del(@PathVariable("id") String id) {
|
|
|
-// List<ApplyInfo> appList = applyInfoFacade.getAppListByManufacturerId(id);
|
|
|
-// if (null != appList && (!appList.isEmpty())) {
|
|
|
-// return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "厂商已被引用,不可删除!");
|
|
|
-// }
|
|
|
-// manufacturerInfoFacade.del(id);
|
|
|
-// return Result.success("删除成功");
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "获取所有厂商的资料")
|
|
|
-// @GetMapping(value = "manufacturer/allManufacturer")
|
|
|
-// public Result<List<ManufacturerVo>> getAllManufacturer() {
|
|
|
-// List<ManufacturerInfo> manufacturerInfoList = new ArrayList<>();
|
|
|
-// BaseSecurityUser user = ContextUtils.getUserInfo();
|
|
|
-// //用户范围
|
|
|
-// String userMt = mtAuthBusiness.getMtAuth(user.getId(), SysConstants.MT_USER);
|
|
|
-// //所有应用
|
|
|
-// List<ApplyInfo> applyInfoList = applyInfoFacade.getAllList();
|
|
|
-// //范围内加过的厂商
|
|
|
-// Set<String> menuSet = new HashSet<>();
|
|
|
-// Map<String, OrgTreeNode> allTreeMap = orgInfoFacade.getAllOrgTreeNode();
|
|
|
-// for (ApplyInfo applyInfo : applyInfoList) {
|
|
|
-// OrgTreeNode node = allTreeMap.get(applyInfo.getOrgId());
|
|
|
-// if (node != null) {
|
|
|
-// logger.info("node getPath路径:{}", node.getPath());
|
|
|
-// }
|
|
|
-// //应用所属机构在范围内
|
|
|
-// if (node != null && OrgInfoUtil.isHaveAuth(node.getValue(), node.getPath(), userMt)) {
|
|
|
-// //未添加的厂商
|
|
|
-// if (!menuSet.contains(applyInfo.getManufacturerId())) {
|
|
|
-// ManufacturerInfo manufacturerInfo = manufacturerInfoFacade.manufacturerInfoDetail(applyInfo.getManufacturerId());
|
|
|
-// if (manufacturerInfo == null) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// menuSet.add(manufacturerInfo.getId());
|
|
|
-// logger.info("应用: {}", manufacturerInfo);
|
|
|
-// manufacturerInfoList.add(manufacturerInfo);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// List<ManufacturerVo> list = new ArrayList<>();
|
|
|
-// for (ManufacturerInfo m : manufacturerInfoList) {
|
|
|
-// ManufacturerVo manufacturerVo = new ManufacturerVo();
|
|
|
-// BeanUtil.copyProperties(m, manufacturerVo);
|
|
|
-// list.add(manufacturerVo);
|
|
|
-// }
|
|
|
-// return Result.success(list);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "获取所有厂商的下拉框")
|
|
|
-// @RequestMapping(value = "/manufacturer/radio")
|
|
|
-// @ResponseBody
|
|
|
-// public Result<List<CodeRecord>> getRadio() {
|
|
|
-// List<ManufacturerInfo> mlist = new ArrayList<>();
|
|
|
-// UserInfo userInfo = userInfoFacade.userDetail(ContextUtils.getUserInfo().getId());
|
|
|
-// //外部人员只能配置自己所属厂商下的应用
|
|
|
-// if (UserTypeEnum.EXTERNAL.getValue().equals(userInfo.getUserType())) {
|
|
|
-// ManufacturerInfo manufacturerInfo = manufacturerInfoFacade.manufacturerInfoDetail(userInfo.getCompany());
|
|
|
-// mlist.add(manufacturerInfo);
|
|
|
-// } else {
|
|
|
-// return Result.success(manufacturerInfoFacade.getAllCodeRecord());
|
|
|
-// }
|
|
|
-// List<CodeRecord> list = new ArrayList<>();
|
|
|
-// for (ManufacturerInfo m : mlist) {
|
|
|
-// CodeRecord codeRecord = new CodeRecord();
|
|
|
-// codeRecord.setValue(m.getId());
|
|
|
-// codeRecord.setLabel(m.getManufacturerName());
|
|
|
-// list.add(codeRecord);
|
|
|
-// }
|
|
|
-// return Result.success(list);
|
|
|
-// }
|
|
|
-//
|
|
|
-// private boolean isManufacturerName(String mName) {
|
|
|
-// ManufacturerInfo manufacturerInfo = manufacturerInfoFacade.getOneByName(mName);
|
|
|
-//
|
|
|
-// return manufacturerInfo != null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 验证厂商代码是否已经存在
|
|
|
-// *
|
|
|
-// * @param code 厂商代码
|
|
|
-// * @return true:存在 false:不存在
|
|
|
-// */
|
|
|
-// private boolean isCodeExist(String code) {
|
|
|
-//
|
|
|
-// ManufacturerInfo manufacturerInfo = manufacturerInfoFacade.detailByCode(code);
|
|
|
-//
|
|
|
-// return manufacturerInfo != null;
|
|
|
-// }
|
|
|
-//}
|