Commit 7de8e948 authored by limei's avatar limei

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents e812b7e4 0c6c0f74
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Set;
/**
* 质量问题表 Mapper 接口
......@@ -17,7 +18,7 @@ import java.util.List;
@Repository
public interface QualityProblemMapper extends BaseMapper<QualityProblem> {
IPage<QualityProblemDto> getItems(IPage<QualityProblemDto> page,QualityProblemDto qualityProblemDto);
IPage<QualityProblemDto> getItems(IPage<QualityProblemDto> page, QualityProblemDto qualityProblemDto, Set<String> projectIds);
QualityProblemDto getInfoBySequenceNbr(String sequenceNbr);
......
......@@ -32,6 +32,12 @@
<if test="qualityProblemDto.code != '' and qualityProblemDto.code != null">
and qi.`code` like concat("%",qualityProblemDto.code,"%")
</if>
<if test="projectIds != null">
and qi.project_id in
<foreach collection="projectIds" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
......
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -113,4 +114,16 @@ public class AttachmentController extends BaseController {
public ResponseModel<List<AttachmentDto>> selectForList() {
return ResponseHelper.buildResponse(attachmentServiceImpl.queryForAttachmentList());
}
/**
* 根据当前登录人获取单位
*
*/
@BusinessIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/unit")
@ApiOperation(httpMethod = "Get",value="单位选择查询",notes= "单位选择查询")
public ResponseModel<String> selectUnit(){
return ResponseHelper.buildResponse(attachmentServiceImpl.selectUnit());
}
}
......@@ -122,8 +122,6 @@ public class EquipmentController extends BaseController {
}
}
return ResponseHelper.buildResponse(equipmentServiceImpl.removeByIds(sequenceNbr));
}
/**
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.Enum.NoticeStatusEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.dto.*;
import com.yeejoin.amos.boot.module.ugp.api.entity.InstallNotice;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
......@@ -294,7 +295,9 @@ public class InstallNoticeController extends BaseController {
InstallNotice installNotice = installNoticeServiceImpl.getById(sequenceNbr);
installNotice.setNoticeStatus(NoticeStatusEnum.已接收.getName());
Project project = projectServiceImpl.getById(installNotice.getProjectId());
projectInitiationServiceImpl.execute(project.getInstanceId(),installNotice,NoticeStatusEnum.已接收.getStatusId());
JSONObject json = JSON.parseObject(JSON.toJSONString(installNotice));
json.put(XJConstant.PROCESS_PROJECT_STATE,"告知待审核");
projectInitiationServiceImpl.execute(project.getInstanceId(),json,NoticeStatusEnum.已接收.getStatusId());
return ResponseHelper.buildResponse(installNoticeServiceImpl.updateById(installNotice));
}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
......@@ -86,16 +87,17 @@ public class MaterialController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除材料信息表", notes = "根据sequenceNbr删除材料信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") List<Long> sequenceNbr) throws Exception {
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") List<Long> sequenceNbr) throws Exception {
LambdaQueryWrapper<ProjectResource> wrapper = new LambdaQueryWrapper<>();
for (Long i:sequenceNbr){
wrapper.eq(ProjectResource::getResourceId,i);
if (!projectResourceMapper.selectList(wrapper).isEmpty()){
throw new Exception("无法删除,已绑定项目");
for (Long i : sequenceNbr) {
wrapper.eq(ProjectResource::getResourceId, i);
if (!projectResourceMapper.selectList(wrapper).isEmpty()) {
return CommonResponseUtil.failure("无法删除,管材:" + materialServiceImpl.getById(i).getName() + "已绑定项目");
}
}
return ResponseHelper.buildResponse(materialServiceImpl.removeByIds(sequenceNbr));
return ResponseHelper.buildResponse(materialServiceImpl.removeByIds(sequenceNbr));
}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectMaterialDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderEquipmentDto;
import com.alibaba.fastjson.JSONObject;
......@@ -12,6 +13,7 @@ import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.MaterialServiceImpl;
import org.aspectj.bridge.Message;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -203,8 +205,10 @@ public class ProjectResourceController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "POST",value = "绑定项目所用到的设备管材", notes = "绑定项目所用到的设备管材")
@PostMapping(value = "/saveId")
public ResponseModel<ProjectResource> saveId(@RequestBody JSONObject jsonObject) throws Exception {
return ResponseHelper.buildResponse(projectResourceServiceImpl.saveIds(jsonObject));
public ResponseModel<ResponseModel> saveId(@RequestBody JSONObject jsonObject) throws Exception {
return ResponseHelper.buildResponse(projectResourceServiceImpl.saveIds(jsonObject));
}
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.ugp.api.entity.QualityProblem;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProblemInitiationServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -53,6 +54,9 @@ public class QualityProblemController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "新增质量问题表", notes = "新增质量问题表")
public ResponseModel<QualityProblemDto> save(@RequestBody QualityProblemDto model) {
model = qualityProblemServiceImpl.createWithModel(model);
QualityProblem qualityProblem = new QualityProblem();
BeanUtils.copyProperties(model, qualityProblem);
problemInitiationService.start(qualityProblem);
return ResponseHelper.buildResponse(model);
}
......
......@@ -8,12 +8,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
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.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderEquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
......@@ -176,9 +178,18 @@ public class WelderController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@DeleteMapping(value = "/deleteOneById/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr删除人员信息表", notes = "根据sequenceNbr删除人员信息表")
public ResponseModel<String> deleteOneById(@PathVariable String sequenceNbr) throws Exception {
public ResponseModel<String> deleteOneById(@PathVariable List<Long> sequenceNbr) throws Exception {
// Privilege.agencyUserClient.multDeleteUser(orgServiceImpl.getOrgUsrById(sequenceNbr).getAmosOrgId());
orgServiceImpl.delectInfo(sequenceNbr);
LambdaQueryWrapper<ProjectResource> wrapper = new LambdaQueryWrapper<>();
for (Long i : sequenceNbr) {
wrapper.eq(ProjectResource::getResourceId, i);
if (!projectResourceMapper.selectList(wrapper).isEmpty()) {
return CommonResponseUtil.failure("无法删除,管材:" + orgServiceImpl.getdetialInfo(String.valueOf(i)).get("name") + "已绑定项目");
}
orgServiceImpl.delectInfo(String.valueOf(i));
}
return ResponseHelper.buildResponse("ok");
}
......
......@@ -3,15 +3,23 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
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.entity.Attachment;
import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IAttachmentService;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import com.yeejoin.amos.boot.module.ugp.biz.controller.ProjectController;
/**
* 附件表服务实现类
......@@ -21,6 +29,11 @@ import java.util.List;
*/
@Service
public class AttachmentServiceImpl extends BaseService<AttachmentDto,Attachment,AttachmentMapper> implements IAttachmentService {
@Autowired
OrgServiceImpl orgServiceImpl;
@Autowired
OrgUsrServiceImpl orgUsrService;
/**
* 分页查询
*/
......@@ -61,4 +74,21 @@ public class AttachmentServiceImpl extends BaseService<AttachmentDto,Attachment,
}
this.save(attachment);
}
/**
*获取登录人的单位
*
*/
@BusinessIdentify
public String selectUnit(){
//获取登录人的redis信息
ReginParams reginParams = orgServiceImpl.getReginParams();
//根据redis信息去获取登录人信息后再获取到登录人的sequenceNbr
Long companyId = reginParams.getBusinessInfo().getCompanySequenceNbr();
OrgUsr orgUsr = orgUsrService.getById(companyId);
String key = orgUsr.getOrgExpandAttr1();
return OrgEnum.map.get(key);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectMaterialDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderEquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.*;
import com.alibaba.fastjson.JSON;
......@@ -16,9 +18,11 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.MaterialMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.WeldMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IProjectResourceService;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectResourceDto;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.apache.ibatis.annotations.Case;
import org.aspectj.weaver.ast.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,6 +32,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
......@@ -136,7 +141,7 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
/**
* 绑定项目所用到的设备管材
*/
public ProjectResource saveIds(JSONObject jsonObject) throws Exception {
public ResponseModel saveIds(JSONObject jsonObject) throws Exception {
JSONArray subForm = jsonObject.getJSONArray("subForm");
ProjectResource Resource = new ProjectResource();
......@@ -148,36 +153,46 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
Long SequenceNbr = Long.valueOf(jsonObject.getString("sequenceNbr"));
String type = jsonObject.getString("type");
LambdaQueryWrapper<ProjectResource> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ProjectResource::getResourceId,select);
wrapper.eq(ProjectResource::getProjectId,SequenceNbr);
wrapper.eq(ProjectResource::getResourceId, select);
wrapper.eq(ProjectResource::getProjectId, SequenceNbr);
ProjectResource projectResourceVerify = projectResourceMapper.selectOne(wrapper);
if (ValidationUtil.isEmpty(projectResourceVerify)){
//判断资源类型并插入
if (type.equals(设备资源.getName())) {
projectResource.setType(设备资源.getCode());
Equipment equipment = equipmentMapper.selectById(select);
projectResource.setName(equipment.getName());
}
if (type.equals(焊工资源.getName())) {
projectResource.setType(焊工资源.getCode());
OrgUsr orgUsrById = orgService.getOrgUsrById(select);
projectResource.setName(orgUsrById.getBizOrgName());
}
if (type.equals(管材资源.getName())) {
projectResource.setType(管材资源.getCode());
Material material = materialMapper.selectById(select);
projectResource.setName(material.getName());
}
projectResource.setProjectId(SequenceNbr);
projectResource.setResourceId(Long.valueOf(select));
BeanUtils.copyProperties(projectResource,Resource);
this.save(projectResource);
}else {
throw new Exception("该资源已存在");
if (ValidationUtil.isEmpty(projectResourceVerify)) {
//判断资源类型并插入
if (type.equals(设备资源.getName())) {
projectResource.setType(设备资源.getCode());
Equipment equipment = equipmentMapper.selectById(select);
projectResource.setName(equipment.getName());
}
if (type.equals(焊工资源.getName())) {
projectResource.setType(焊工资源.getCode());
OrgUsr orgUsrById = orgService.getOrgUsrById(select);
projectResource.setName(orgUsrById.getBizOrgName());
}
if (type.equals(管材资源.getName())) {
projectResource.setType(管材资源.getCode());
Material material = materialMapper.selectById(select);
projectResource.setName(material.getName());
}
projectResource.setProjectId(SequenceNbr);
projectResource.setResourceId(Long.valueOf(select));
BeanUtils.copyProperties(projectResource, Resource);
boolean save = this.save(projectResource);
//判断
if (save && type.equals(设备资源.getName())) {
LambdaQueryWrapper<Equipment> wrapperEquipment = new LambdaQueryWrapper<>();
wrapperEquipment.eq(BaseEntity::getSequenceNbr, select);
Equipment equipment = new Equipment();
equipment.setUseStatus("已使用");
equipmentMapper.update(equipment, wrapperEquipment);
}
} else {
// throw new Exception("该资源已存在");
return CommonResponseUtil.failure("该资源已存在");
}
}
return Resource;
return CommonResponseUtil.success();
}
......
......@@ -214,9 +214,11 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
install=true;
}
}
if(design && install){
projectInitiationService.execute(project.getInstanceId(),projectDto,"1");
String type = jsonObject.getString("type");
if (type != null) {
if (design && install) {
projectInitiationService.execute(project.getInstanceId(), projectDto, "1");
}
}
return "ok";
}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProblemProcessEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProblemTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.QualityProblem;
import com.yeejoin.amos.boot.module.ugp.api.mapper.QualityProblemMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IQualityProblemService;
......@@ -12,9 +13,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* 质量问题表服务实现类
......@@ -34,6 +33,9 @@ public class QualityProblemServiceImpl extends BaseService<QualityProblemDto,Qua
@Autowired
OrgServiceImpl orgService;
@Autowired
ProjectResourceServiceImpl projectResourceService;
/**
* 分页查询
*/
......@@ -50,11 +52,15 @@ public class QualityProblemServiceImpl extends BaseService<QualityProblemDto,Qua
@Override
public IPage<QualityProblemDto> getItems(String current, String size,QualityProblemDto qualityProblemDto) {
Set<String> projectIds = new HashSet<>();
for(Project project:projectResourceService.getProjectList()){
projectIds.add(String.valueOf(project.getSequenceNbr()));
}
List<QualityProblemDto> list = new ArrayList<>();
IPage<QualityProblemDto> page = new Page<>();
page.setCurrent(Long.parseLong(current));
page.setSize(Long.parseLong(size));
page = qualityProblemMapper.getItems(page,qualityProblemDto);
page = qualityProblemMapper.getItems(page,qualityProblemDto,projectIds);
List<QualityProblemDto> qualityProblemDtoList = page.getRecords();
for (QualityProblemDto qualityProblemDto1 : qualityProblemDtoList) {
qualityProblemDto1.setChargerPersonName(orgService.getOrgUsrById(qualityProblemDto1.getChargerPersonId()).getBizOrgName());
......@@ -132,8 +138,6 @@ public class QualityProblemServiceImpl extends BaseService<QualityProblemDto,Qua
}
}
this.updateById(quality);
return "0k";
}
......
......@@ -44,4 +44,6 @@ amos.system.user.product=AMOS_STUDIO_WEB
amos.system.user.app-key=AMOS_STUDIO
supervisionRoleId=1582983768581369857
installationRoleId=1585099284334800898
\ No newline at end of file
installationRoleId=1585099284334800898
monitoringRoleId=1585099377079250946
constructionRoleId=1585099241989107713
\ No newline at end of file
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