陈昶聿
3 天以前 67c6b3ec9f9a916e5f39a1c0b14499e66f78c982
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceOutPathController.java
@@ -1,13 +1,20 @@
package com.ruoyi.web.controller.smartor;
import com.ruoyi.common.annotation.AddOrgId;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.BaseOrganization;
import com.smartor.domain.ServiceOutPath;
import com.smartor.domain.ServiceTask;
import com.smartor.service.IBaseOrganizationService;
import com.smartor.service.IServiceOutPathService;
import com.smartor.service.IServiceTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
@@ -29,6 +36,12 @@
public class ServiceOutPathController extends BaseController {
    @Autowired
    private IServiceOutPathService serviceOutPathService;
    @Autowired
    private IServiceTaskService serviceTaskService;
    @Autowired
    private IBaseOrganizationService baseOrganizationService;
    /**
     * 查询主键列表
@@ -57,6 +70,24 @@
            ServiceOutPath serviceOutPath1 = list.get(0);
            serviceOutPath1.setId(null);
            serviceOutPath1.setRadix(null);
            //根据taskid获取机构信息
            if(StringUtils.isNotEmpty(serviceOutPath1.getParam1())){
                String taskId = serviceOutPath1.getParam1();
                if(StringUtils.isNotEmpty(taskId)){
                    ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(Long.valueOf(taskId));
                    String orgId = serviceTask.getOrgid();
                    if(StringUtils.isNotEmpty(orgId)){
                        BaseOrganization baseOrganization = new BaseOrganization();
                        baseOrganization.setOrgid(orgId);
                        List<BaseOrganization> orgs = baseOrganizationService.selectBaseOrganizationList(baseOrganization);
                        if(CollectionUtils.isNotEmpty(orgs)){
                            String orgname = orgs.get(0).getOrganizationName();
                            serviceOutPath1.setOrgid(orgId);
                            serviceOutPath1.setOrgname(orgname);
                        }
                    }
                }
            }
            return success(serviceOutPath1);
        }
        return success(null);
@@ -89,6 +120,7 @@
     */
    @ApiOperation("新增主键")
    @Log(title = "主键", businessType = BusinessType.INSERT)
    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ServiceOutPath serviceOutPath) {
        return toAjax(serviceOutPathService.insertServiceOutPath(serviceOutPath));
@@ -100,6 +132,7 @@
    @ApiOperation("修改主键")
    //@PreAuthorize("@ss.hasPermi('smartor:path:edit')")
    @Log(title = "主键", businessType = BusinessType.UPDATE)
    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody ServiceOutPath serviceOutPath) {
        return toAjax(serviceOutPathService.updateServiceOutPath(serviceOutPath));