Commit b04feb36 authored by lisong's avatar lisong

更新

parent 5caf7fef
......@@ -127,4 +127,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
Page<OrgUsr> getWelderByProjectId(@Param("page") Page<OrgUsr> page, @Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
Page<OrgUsr> getAllListByProjectId(@Param("page") Page<OrgUsr> page, @Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
List<OrgUsr> getWelderListByProjectId( @Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
}
......@@ -912,6 +912,21 @@ LEFT JOIN (
</where>
</select>
<select id="getWelderListByProjectId" 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>
upr.type = 'welder' AND upr.project_id = #{projectId}
AND cou.parent_id = #{companyId}
<if test="name != null and name != ''">
and cou.biz_org_name like concat('%', #{name}, '%')
</if>
</where>
</select>
</mapper>
......@@ -2486,4 +2486,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return this.baseMapper.getAllListByProjectId(page, projectId, companyId, name);
}
public List<OrgUsr> getWelderListByProjectId(String projectId, Long companyId, String name) {
return this.baseMapper.getWelderListByProjectId(projectId, companyId, name);
}
}
\ No newline at end of file
......@@ -27,4 +27,7 @@ public interface EquipmentMapper extends BaseMapper<Equipment> {
Page<EquipmentDto> boundWelder(@Param("page" )IPage<EquipmentDto> page, @Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
Page<EquipmentDto> allBoundWelder(@Param("page" )IPage<EquipmentDto> page, @Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
List<EquipmentDto> boundWelderList(@Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
}
......@@ -68,6 +68,20 @@
</where>
</select>
<select id="boundWelderList" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto">
SELECT
ue.*
FROM
tz_ugp_equipment ue
LEFT JOIN tz_ugp_project_resource upr ON ue.sequence_nbr = upr.resource_id
<where>
upr.type = 'equipment' AND upr.project_id = #{projectId}
AND ue.company_id = #{companyId}
<if test="name != null and name != ''">
and ue.name like concat('%', #{name}, '%')
</if>
</where>
</select>
</mapper>
......@@ -293,8 +293,8 @@ public class EquipmentController extends BaseController {
@GetMapping(value = "/boundWelder")
@ApiOperation(httpMethod = "GET", value = "查询已绑定焊机信息", notes = "查询已绑定焊机信息")
public ResponseModel<Object> boundWelder(@RequestParam(value = "projectId") String projectId,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "name", required = false) String name) {
return ResponseHelper.buildResponse(equipmentServiceImpl.boundWelder(projectId, current, size, name, null));
}
......
......@@ -287,8 +287,8 @@ public class WelderController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询项目已绑定焊工信息", notes = "查询项目已绑定焊工信息")
@GetMapping(value = "/getWelderByProjectId")
public ResponseModel<Object> getWelderByProjectId(@RequestParam(value = "projectId") String projectId,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "name", required = false) String name) {
return ResponseHelper.buildResponse(welderServiceImpl.getWelderByProjectId(projectId, current, size, name, null));
}
......
......@@ -290,20 +290,28 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@BusinessIdentify
public Page<EquipmentDto> boundWelder(String projectId, int current, int size, String name, String type) {
public Page<EquipmentDto> boundWelder(String projectId, Integer current, Integer size, String name, String type) {
ReginParams reginParams = orgService.getReginParams();
Long companySequenceNbr = reginParams.getBusinessInfo().getCompanySequenceNbr();
Page<EquipmentDto> page = new Page<>(current, size);
Page<EquipmentDto> result;
if (!ObjectUtils.isEmpty(type) && "all".equals(type)) {
result = equipmentMapper.boundWelder(page, projectId, companySequenceNbr, name);
if (!ObjectUtils.isEmpty(current) || !ObjectUtils.isEmpty(size)) {
Page<EquipmentDto> result;
Page<EquipmentDto> page = new Page<>(current, size);
if (!ObjectUtils.isEmpty(type) && "all".equals(type)) {
result = equipmentMapper.allBoundWelder(page, projectId, companySequenceNbr, name);
} else {
result = equipmentMapper.boundWelder(page, projectId, companySequenceNbr, name);
}
result.getRecords().forEach(item -> {
List<JSONObject> files = attachmentServiceImpl.getFilesBySourceId(item.getSequenceNbr());
item.setFiles(files);
});
return result;
} else {
result = equipmentMapper.allBoundWelder(page, projectId, companySequenceNbr, name);
// 不分页时返回全部、定制组件格式统一
Page<EquipmentDto> listPage = new Page<>();
List<EquipmentDto> equipmentDtos = equipmentMapper.boundWelderList(projectId, companySequenceNbr, name);
listPage.setRecords(equipmentDtos);
return listPage;
}
result.getRecords().forEach(item -> {
List<JSONObject> files = attachmentServiceImpl.getFilesBySourceId(item.getSequenceNbr());
item.setFiles(files);
});
return result;
}
}
\ No newline at end of file
......@@ -715,17 +715,21 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
private List<Map<String, Object>> data(String type, List<Map<String, Object>> data, List<Map<String, Object>> result, Date date) {
data.forEach(item -> {
HashMap<String, Object> messageData = new HashMap<>();
messageData.put("name", item.get("type"));
messageData.put("companyName", item.get("type"));
messageData.put("Symbol_key", item.get("Symbol_key"));
messageData.put("date", date);
messageData.put("type", type);
messageData.put("type", item.get(type));
List<Map<String, Object>> infoList = (List<Map<String, Object>>) item.get("info");
infoList.forEach(itemInfo -> {
messageData.put("fileName", itemInfo.get("name"));
messageData.put("fileUrl", itemInfo.get("url"));
messageData.put("uid", itemInfo.get("uid"));
messageData.put("status", itemInfo.getOrDefault("auditStatus", "1"));
result.add(messageData);
});
messageData.put("files", infoList);
messageData.put("status", item.getOrDefault("auditStatus", "1"));
result.add(messageData);
// infoList.forEach(itemInfo -> {
// messageData.put("fileName", itemInfo.get("name"));
// messageData.put("fileUrl", itemInfo.get("url"));
// messageData.put("uid", itemInfo.get("uid"));
// messageData.put("status", itemInfo.getOrDefault("auditStatus", "1"));
// result.add(messageData);
// });
});
return result;
}
......@@ -807,23 +811,23 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
// 保存资源信息
saveResourceMessage(equipmentList, welderList, materialList, projectId);
// 文件信息
AttachmentDto attachmentDto = attachmentService.getAttachment(projectId);
if (!ObjectUtils.isEmpty(attachmentDto) && !ObjectUtils.isEmpty(attachmentDto.getInfo())) {
Map<String, Object> map = JSON.parseObject(attachmentDto.getInfo());
LambdaQueryWrapper<Attachment> lambda = new QueryWrapper<Attachment>().lambda();
lambda.eq(Attachment::getSourceId, projectId);
List<Attachment> attachments = attachmentMapper.selectList(lambda);
Attachment attachment = null;
if (!ObjectUtils.isEmpty(attachments)){
attachment = attachments.get(0);
}
if (!ObjectUtils.isEmpty(attachment) && !ObjectUtils.isEmpty(attachment.getInfo())) {
Map<String, Object> map = JSON.parseObject(attachment.getInfo());
List<Map<String, Object>> installSubForm = (List<Map<String, Object>>) map.get("installSubForm");
// 文件信息json处理
changeStatus(installSubForm, fileList);
List<Map<String, Object>> designSubForm = (List<Map<String, Object>>) map.get("designSubForm");
// 文件信息json处理
changeStatus(designSubForm, fileList);
Attachment attachment = new Attachment();
attachment.setSourceId(projectId);
attachment.setInfo(JSON.toJSONString(map));
attachment.setType("project");
LambdaQueryWrapper<Attachment> attachmentLambda = new QueryWrapper<Attachment>().lambda();
attachmentLambda.eq(Attachment::getSourceId, projectId);
attachmentMapper.delete(attachmentLambda);
attachmentService.save(attachment);
attachmentService.saveOrUpdate(attachment);
}
if ("submit".equals(type)) {
......@@ -835,11 +839,13 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
private void changeStatus(List<Map<String, Object>> data, List<Map<String, Object>> fileList) {
data.forEach(item -> {
List<Map<String, Object>> installSubFormInfo = (List<Map<String, Object>>) item.get("info");
installSubFormInfo.forEach(infoItem -> {
List<Map<String, Object>> collect = fileList.stream().filter(itemData -> itemData.get("uid").equals(infoItem.get("uid"))).collect(Collectors.toList());
infoItem.put("auditStatus", ObjectUtils.isEmpty(collect.get(0).get("status")) ? "" : collect.get(0).get("status"));
});
List<Map<String, Object>> collect = fileList.stream().filter(itemData -> itemData.get("Symbol_key").equals(item.get("Symbol_key"))).collect(Collectors.toList());
item.put("auditStatus", ObjectUtils.isEmpty(collect.get(0).get("status")) ? "" : collect.get(0).get("status"));
// List<Map<String, Object>> installSubFormInfo = (List<Map<String, Object>>) item.get("info");
// installSubFormInfo.forEach(infoItem -> {
// List<Map<String, Object>> collect = fileList.stream().filter(itemData -> itemData.get("uid").equals(infoItem.get("uid"))).collect(Collectors.toList());
// infoItem.put("auditStatus", ObjectUtils.isEmpty(collect.get(0).get("status")) ? "" : collect.get(0).get("status"));
// });
});
}
}
\ No newline at end of file
......@@ -219,23 +219,31 @@ public class WelderServiceImpl {
@BusinessIdentify
public Page<Map<String, Object>> getWelderByProjectId(String projectId, int current, int size, String name, String type) {
public Page<Map<String, Object>> getWelderByProjectId(String projectId, Integer current, Integer size, String name, String type) {
String columnKey = "column";
String valueKey = "value";
Page<Map<String, Object>> mapPage = new Page<>();
ArrayList<Map<String, Object>> maps = new ArrayList<>();
ReginParams reginParams = orgService.getReginParams();
Long companySequenceNbr = reginParams.getBusinessInfo().getCompanySequenceNbr();
Page<OrgUsr> page = new Page<>(current, size);
if (!ObjectUtils.isEmpty(type) && "all".equals(type)) {
page = orgUsrService.getAllListByProjectId(page, projectId, companySequenceNbr, name);
List<OrgUsr> usrList;
// 分页参数为空时返回全部
if (!ObjectUtils.isEmpty(current) || !ObjectUtils.isEmpty(size)) {
Page<OrgUsr> page = new Page<>(current, size);
if (!ObjectUtils.isEmpty(type) && "all".equals(type)) {
page = orgUsrService.getAllListByProjectId(page, projectId, companySequenceNbr, name);
} else {
page = orgUsrService.getWelderByProjectId(page, projectId, companySequenceNbr, name);
}
mapPage.setTotal(page.getTotal());
mapPage.setSize(page.getSize());
mapPage.setPages(page.getPages());
usrList = page.getRecords();
} else {
page = orgUsrService.getWelderByProjectId(page, projectId, companySequenceNbr, name);
usrList = orgUsrService.getWelderListByProjectId(projectId, companySequenceNbr, name);
}
List<OrgUsr> usrList = page.getRecords();
mapPage.setTotal(page.getTotal());
mapPage.setSize(page.getSize());
mapPage.setPages(page.getPages());
usrList.forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("status", "1");
......@@ -245,7 +253,7 @@ public class WelderServiceImpl {
if (String.valueOf(dataItem.get(columnKey)).equals("image") && !ObjectUtils.isEmpty(dataItem.get(columnKey)) && !ObjectUtils.isEmpty(dataItem.get(valueKey))) {
String value1 = String.valueOf(dataItem.get(valueKey));
List<Map<String, Object>> imageMap = (List<Map<String, Object>>) JSON.parse(value1);
if (!ObjectUtils.isEmpty(imageMap)){
if (!ObjectUtils.isEmpty(imageMap)) {
map.put("files", imageMap);
}
}
......
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