forked from rongchao/epmet-cloud-rizhao
14 changed files with 488 additions and 17 deletions
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotEmpty; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区块链:创建项目form dto |
|||
*/ |
|||
@Data |
|||
public class BlockChainCreateProjectFormDTO { |
|||
|
|||
@NotNull(message = "项目信息不能为空") |
|||
private BlockChainProjectFormDTO project; |
|||
|
|||
@NotNull(message = "处理进展信息不能为空") |
|||
private BlockChainProjectProcessFormDTO process; |
|||
|
|||
@NotNull(message = "指派的人员列表信息不能为空") |
|||
@NotEmpty(message = "指派的人员列表信息不能为空") |
|||
private List<BlockChainProjectProcessAssignedStaffFormDTO> assignedStaffs; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区块链:项目处理进展信息 |
|||
*/ |
|||
@Data |
|||
public class BlockChainProcessProjectFormDTO { |
|||
|
|||
@NotNull(message = "处理进展信息不能为空") |
|||
private BlockChainProjectProcessFormDTO process; |
|||
|
|||
private List<BlockChainProjectProcessAssignedStaffFormDTO> assignedStaffs; |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 区块链项目信息formdto |
|||
*/ |
|||
@Data |
|||
public class BlockChainProjectFormDTO { |
|||
@NotBlank(message = "项目ID必填") |
|||
private String projectId; |
|||
@NotBlank(message = "客户ID必填") |
|||
private String customerId; |
|||
@NotBlank(message = "标题必填") |
|||
private String title; |
|||
@NotBlank(message = "组织ID必填") |
|||
private String agencyId; |
|||
@NotBlank(message = "项目来源必填") |
|||
private String origin; |
|||
@NotBlank(message = "项目来源ID必填") |
|||
private String originId; |
|||
@NotBlank(message = "项目状态必填") |
|||
private String status; |
|||
@NotBlank(message = "关闭状态必填") |
|||
private String closeStatus; |
|||
@NotBlank(message = "组织ID PATH必填") |
|||
private String orgIdPath; |
|||
@NotBlank(message = "定位必填") |
|||
private String locateAddress; |
|||
@NotBlank(message = "经度必填") |
|||
private String locateLongitude; |
|||
@NotBlank(message = "维度必填") |
|||
private String locateDimension; |
|||
@NotBlank(message = "创建时间必填") |
|||
private Date createdTime; |
|||
@NotBlank(message = "创建者ID必填") |
|||
private String createdBy; |
|||
} |
@ -0,0 +1,52 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 区块链:指派的项目处理人员 form dto |
|||
*/ |
|||
@Data |
|||
public class BlockChainProjectProcessAssignedStaffFormDTO { |
|||
@NotBlank(message = "ID必填") |
|||
private String id; |
|||
|
|||
@NotBlank(message = "进展ID必填") |
|||
private String processId; |
|||
|
|||
@NotBlank(message = "项目ID必填") |
|||
private String projectId; |
|||
|
|||
@NotBlank(message = "客户ID必填") |
|||
private String customerId; |
|||
|
|||
@NotBlank(message = "组织ID必填") |
|||
private String orgId; |
|||
|
|||
@NotBlank(message = "部门ID必填") |
|||
private String departmentId; |
|||
|
|||
@NotBlank(message = "网格ID必填") |
|||
private String gridId; |
|||
|
|||
@NotBlank(message = "组织ID PATH必填") |
|||
private String orgIdPath; |
|||
|
|||
@NotBlank(message = "人员ID必填") |
|||
private String staffId; |
|||
|
|||
@NotBlank(message = "部门名称必填") |
|||
private String departmentName; |
|||
|
|||
@NotBlank(message = "是否处理必填") |
|||
private String isHandle; |
|||
|
|||
@NotBlank(message = "创建者ID必填") |
|||
private String createdBy; |
|||
|
|||
@NotBlank(message = "创建时间必填") |
|||
private Date createdTime; |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 区块链:项目处理form dto |
|||
*/ |
|||
@Data |
|||
public class BlockChainProjectProcessFormDTO { |
|||
@NotBlank(message = "处理ID必填") |
|||
private String processId; |
|||
@NotBlank(message = "项目ID必填") |
|||
private String projectId; |
|||
@NotBlank(message = "客户ID必填") |
|||
private String customerId; |
|||
@NotBlank(message = "部门名称必填") |
|||
private String departmentName; |
|||
@NotBlank(message = "组织ID必填") |
|||
private String agencyId; |
|||
@NotBlank(message = "部门ID必填") |
|||
private String departmentId; |
|||
@NotBlank(message = "网格ID必填") |
|||
private String gridId; |
|||
@NotBlank(message = "组织ID PATH必填") |
|||
private String orgIdPath; |
|||
@NotBlank(message = "处理人员ID必填") |
|||
private String staffId; |
|||
@NotBlank(message = "操作类型必填") |
|||
private String operation; |
|||
@NotBlank(message = "操作名称必填") |
|||
private String operationName; |
|||
@NotBlank(message = "公开答复必填") |
|||
private String publicReply; |
|||
@NotBlank(message = "内部备注必填必填") |
|||
private String internalRemark; |
|||
@NotNull(message = "结束时间必填") |
|||
private Date endTime; |
|||
@NotNull(message = "是否发送到外部系统必填") |
|||
private Integer isSend; |
|||
@NotNull(message = "耗费天数必填") |
|||
private Integer costWorkDays; |
|||
@NotBlank(message = "创建者ID必填") |
|||
private String createdBy; |
|||
@NotNull(message = "创建时间必填") |
|||
private Date createdTime; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.BlockChainCreateProjectFormDTO; |
|||
import com.epmet.dto.form.BlockChainProcessProjectFormDTO; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 区块链project相关controller |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/blockchain/project") |
|||
public class BlockChainProjectController { |
|||
|
|||
/** |
|||
* 立项 |
|||
* @param input |
|||
* @return |
|||
*/ |
|||
@PostMapping("create") |
|||
public Result blockChainCreateProject(@RequestBody BlockChainCreateProjectFormDTO input) { |
|||
ValidatorUtils.validateEntity(input); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 处理进展 |
|||
* @param input |
|||
* @return |
|||
*/ |
|||
@PostMapping("process") |
|||
public Result blockChainProcessProject(@RequestBody BlockChainProcessProjectFormDTO input) { |
|||
ValidatorUtils.validateEntity(input); |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.entity.ProjectProcessEntity; |
|||
import com.epmet.entity.ProjectStaffEntity; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 上链service接口 |
|||
*/ |
|||
public interface BlockChainUploadService { |
|||
|
|||
/** |
|||
* 数据上链 |
|||
* @param processEntity 处理进展entity |
|||
* @param assignedStaffEntities 指派给的工作人员entity |
|||
*/ |
|||
void send2BlockChain(ProjectProcessEntity processEntity, List<ProjectStaffEntity> assignedStaffEntities); |
|||
} |
@ -0,0 +1,94 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.dao.ProjectStaffDao; |
|||
import com.epmet.dto.form.BlockChainProcessProjectFormDTO; |
|||
import com.epmet.dto.form.BlockChainProjectProcessAssignedStaffFormDTO; |
|||
import com.epmet.dto.form.BlockChainProjectProcessFormDTO; |
|||
import com.epmet.entity.ProjectProcessEntity; |
|||
import com.epmet.entity.ProjectStaffEntity; |
|||
import com.epmet.feign.EpmetThirdOpenFeignClient; |
|||
import com.epmet.service.BlockChainUploadService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 区块链上链service实现 |
|||
*/ |
|||
@Service |
|||
public class BlockChainUploadServiceImpl implements BlockChainUploadService { |
|||
|
|||
@Autowired |
|||
private EpmetThirdOpenFeignClient thirdOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private ProjectStaffDao projectStaffDao; |
|||
|
|||
/** |
|||
* 数据上链 |
|||
* @param processEntity 处理进展entity |
|||
* @param assignedStaffEntities 指派给的工作人员entity |
|||
*/ |
|||
public void send2BlockChain(ProjectProcessEntity processEntity, List<ProjectStaffEntity> assignedStaffEntities) { |
|||
|
|||
BlockChainProjectProcessFormDTO process = new BlockChainProjectProcessFormDTO(); |
|||
process.setProcessId(processEntity.getId()); |
|||
process.setCreatedBy(processEntity.getCreatedBy()); |
|||
process.setCreatedTime(processEntity.getCreatedTime()); |
|||
String costWorkdays = processEntity.getCostWorkdays(); |
|||
process.setCostWorkDays(StringUtils.isBlank(costWorkdays) ? null : Integer.valueOf(costWorkdays)); |
|||
process.setAgencyId(processEntity.getAgencyId()); |
|||
process.setCustomerId(processEntity.getCustomerId()); |
|||
process.setDepartmentId(processEntity.getDepartmentId()); |
|||
process.setDepartmentName(processEntity.getDepartmentName()); |
|||
process.setEndTime(processEntity.getEndTime()); |
|||
process.setGridId(processEntity.getGridId()); |
|||
process.setInternalRemark(processEntity.getInternalRemark()); |
|||
process.setIsSend(processEntity.getIsSend()); |
|||
process.setOperation(processEntity.getOperation()); |
|||
process.setOperationName(processEntity.getOperationName()); |
|||
process.setOrgIdPath(processEntity.getOrgIdPath()); |
|||
process.setProjectId(processEntity.getProjectId()); |
|||
process.setPublicReply(processEntity.getPublicReply()); |
|||
process.setStaffId(processEntity.getStaffId()); |
|||
|
|||
if (assignedStaffEntities == null) { |
|||
LambdaQueryWrapper<ProjectStaffEntity> query = new LambdaQueryWrapper<>(); |
|||
query.eq(ProjectStaffEntity::getProcessId, process.getProjectId()); |
|||
assignedStaffEntities = projectStaffDao.selectList(query); |
|||
} |
|||
|
|||
if (CollectionUtils.isEmpty(assignedStaffEntities)) { |
|||
assignedStaffEntities = new ArrayList<>(); |
|||
} |
|||
|
|||
List<BlockChainProjectProcessAssignedStaffFormDTO> assignedStaffs = assignedStaffEntities.stream().map(e -> { |
|||
BlockChainProjectProcessAssignedStaffFormDTO assignedStaff = new BlockChainProjectProcessAssignedStaffFormDTO(); |
|||
assignedStaff.setStaffId(e.getStaffId()); |
|||
assignedStaff.setCreatedBy(e.getCreatedBy()); |
|||
assignedStaff.setCustomerId(e.getCustomerId()); |
|||
assignedStaff.setCreatedTime(e.getCreatedTime()); |
|||
assignedStaff.setProcessId(e.getProcessId()); |
|||
assignedStaff.setDepartmentId(e.getDepartmentId()); |
|||
assignedStaff.setDepartmentName(e.getDepartmentName()); |
|||
assignedStaff.setGridId(e.getGridId()); |
|||
assignedStaff.setId(e.getId()); |
|||
assignedStaff.setIsHandle(e.getIsHandle()); |
|||
assignedStaff.setOrgId(e.getOrgId()); |
|||
assignedStaff.setOrgIdPath(e.getOrgIdPath()); |
|||
assignedStaff.setProjectId(e.getProjectId()); |
|||
return assignedStaff; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
BlockChainProcessProjectFormDTO form = new BlockChainProcessProjectFormDTO(); |
|||
form.setProcess(process); |
|||
form.setAssignedStaffs(assignedStaffs); |
|||
thirdOpenFeignClient.blockChainProcessProject(form); |
|||
} |
|||
} |
Loading…
Reference in new issue