Commit 9f6f35f1 authored by lisong's avatar lisong

添加焊工人员查询接口

parent 80ee6e69
......@@ -139,6 +139,8 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
Map<String, Object> getCurentCarIsUserPhone(long carId);
List<Map<String, Object>> getOrgPersonTelphone(List<Map<String, Object>> companyIds);
List<Map<String, Object>> getMessageByInstanceId(@Param("instanceId") String instanceId);
}
......@@ -122,4 +122,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
String getParentList(@Param("id") String id);
List<OrgUsr> selectPersonListByCompanyIdList(@Param("companyIdList") List<String> companyIdList);
List<OrgUsr> getWelderByProjectId(@Param("projectId") String projectId, @Param("companyId") Long companyId);
}
......@@ -572,5 +572,9 @@ FROM
WHERE
dd.administrativePositionCode IS NOT NULL
</select>
<select id="getMessageByInstanceId" resultType="java.util.Map">
SELECT dfi.field_code as column,dfi.field_value as value
FROM cb_dynamic_form_instance dfi WHERE dfi.instance_id = #{instanceId}
</select>
</mapper>
......@@ -881,6 +881,23 @@ LEFT JOIN (
#{companyId}
</foreach>);
</select>
<select id="getWelderByProjectId" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
cou.*
FROM
cb_org_usr cou
LEFT JOIN tz_ugp_project_resource upr ON cou.sequence_nbr = upr.resource_id
<where>
<if test="projectId != null and projectId != ''">
upr.project_id = #{projectId}
</if>
<if test="projectId == null or projectId == ''">
upr.resource_id is null
</if>
AND cou.parent_id = #{companyId}
</where>
</select>
</mapper>
......@@ -198,5 +198,10 @@ public class DynamicFormInstanceServiceImpl extends BaseService<DynamicFormInsta
}
return Lists.newArrayList();
}
public List<Map<String, Object>> getMessageMapByInstanceId(String instanceId) {
List<Map<String, Object>> message = dynamicFormInstanceMapper.getMessageByInstanceId(instanceId);
return message;
}
}
......@@ -2478,4 +2478,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return this.baseMapper.selectList(wrapper).stream().collect(Collectors.toList());
}
public List<OrgUsr> getWelderByProjectId(String projectId, Long companyId) {
return this.baseMapper.getWelderByProjectId(projectId, companyId);
}
}
\ No newline at end of file
......@@ -5,7 +5,10 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.UserDto;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
......@@ -31,6 +34,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -68,6 +72,10 @@ public class WelderController extends BaseController {
ProjectResourceServiceImpl projectResourceServiceImpl;
@Autowired
DynamicFormInstanceServiceImpl alertFormValueServiceImpl;
@Autowired
private RedisUtils redisUtils;
/**
* 新增/修改焊工信息
*
......@@ -269,4 +277,17 @@ public class WelderController extends BaseController {
public ResponseModel<List<Map>> welderStatistics() {
return ResponseHelper.buildResponse(welderServiceImpl.welderStatistics());
}
/**
* 项目绑定焊工人员信息
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询项目已绑定焊工信息", notes = "查询项目已绑定焊工信息")
@GetMapping(value = "/getWelderByProjectId")
public ResponseModel<Object> getWelderByProjectId(@RequestParam(value = "projectId", required = false)String projectId,
@RequestParam(value = "current")int current,
@RequestParam(value = "size")int size) {
return ResponseHelper.buildResponse(welderServiceImpl.getWelderByProjectId(projectId, current, size));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DynamicFormInstanceServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
......@@ -16,6 +19,7 @@ import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.WelderMapper;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
......@@ -23,6 +27,7 @@ import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*;
......@@ -55,6 +60,9 @@ public class WelderServiceImpl {
@Autowired
MaterialServiceImpl materialServiceImpl;
@Autowired
DynamicFormInstanceServiceImpl alertFormValueServiceImpl;
/**
......@@ -207,4 +215,31 @@ public class WelderServiceImpl {
}
return welderMapper.welderStatistics(personCode);
}
@BusinessIdentify
public Page<Map<String, Object>> getWelderByProjectId(String projectId, int current, int size) {
Page<Map<String, Object>> mapPage = new Page<>();
ArrayList<Map<String, Object>> maps = new ArrayList<>();
ReginParams reginParams = orgService.getReginParams();
Long companySequenceNbr = reginParams.getBusinessInfo().getCompanySequenceNbr();
List<OrgUsr> usrList = orgUsrService.getWelderByProjectId(projectId, companySequenceNbr);
mapPage.setTotal(usrList.size());
List<OrgUsr> collect = usrList.stream()
.skip((long) (current - 1) * size)
.limit(size)
.collect(Collectors.toList());
collect.forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("sequenceNbr", item.getSequenceNbr());
List<Map<String, Object>> message = alertFormValueServiceImpl.getMessageMapByInstanceId(String.valueOf(item.getSequenceNbr()));
message.forEach(dataItem -> {
map.put(String.valueOf(dataItem.get("column")), dataItem.get("value"));
});
maps.add(map);
});
mapPage.setRecords(maps);
return mapPage;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment