Commit f9a56447 authored by srx's avatar srx

Merge remote-tracking branch 'origin/developer' into developer

# Conflicts: # amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/ProjectServiceImpl.java
parents 68c50192 a88304e9
......@@ -3,16 +3,40 @@ package com.yeejoin.amos.boot.module.common.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@Getter
@AllArgsConstructor
public enum OrgPersonEnum {
公司("COMPANY", "244", "公司"),
部门("DEPARTMENT", "245", "部门"),
人员("PERSON", "246", "人员");
公司("COMPANY", "244", "公司",1),
部门("DEPARTMENT", "245", "部门",2),
人员("PERSON", "246", "人员",3),
焊工("WELDER","247","焊工",3),
建设单位负责人("CHARGE","254","建设单位负责人",3),
企业管理员("ADMIN","248","企业管理员",3),
建设单位("CONSTRUCTION","249","建设单位",1),
安装单位("INSTALL","250","安装单位",1),
设计单位("DESIGN","251","设计单位",1),
监察单位("SUPERVISION","252","监察单位",1),
监检机构("MONITORING","253","监检机构",1);
private String key;
private String code;
private String name;
/**
* 1 公司 2 部门 3 人员
*/
private Integer type;
public static Map map = new HashMap();
static {
for(OrgPersonEnum orgPersonEnum:OrgPersonEnum.values()){
map.put(orgPersonEnum.getName(),orgPersonEnum.getKey());
}
}
}
......@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -43,15 +44,6 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.CheckObjectDto;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson;
import com.yeejoin.amos.boot.module.common.api.dto.ESOrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.UserDto;
import com.yeejoin.amos.boot.module.common.api.dto.UserUnitDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
......
......@@ -30,7 +30,7 @@ public interface IRegUnitInfoService {
* @param unitType 单位类型
* @return RegUnitInfoDto
*/
RegUnitInfoDto unitCheck(String unitCode, String unitType);
RegUnitInfoDto unitCheck(String unitCode, String unitType,String companyName);
/**
* 单位类型列表字典
......
......@@ -54,6 +54,9 @@ public class TzsAuthServiceImpl implements TzsAuthService {
*/
@Value("${redis.cache.failure.time}")
private Long redisRegionTimeSecond;
@Autowired
private StartPlatformTokenService startPlatformTokenService;
@Override
......@@ -75,7 +78,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
@Override
public List<RegionModel> getUserReginTree() {
List<String> regionList = this.getUserRegionCode();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
//AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
startPlatformTokenService.getToken();
List<RegionModel> tree = (List<RegionModel>) Systemctl.regionClient.queryForTree(null).getResult();
// 循环list 将List 封装为 省市区 SET
Set<String> city = new HashSet<>();
......@@ -128,8 +132,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
for(Map.Entry<String, RegionModel> entries : tempCityMap.entrySet()) {
newCity.add(entries.getValue());
}
start.setChildren(newCity);
newTree.add(start);
//start.setChildren(newCity);
newTree.addAll(newCity);
return newTree;
}
......
......@@ -66,9 +66,6 @@ public class RegUnitInfoController extends BaseController {
@Value("${flc.sms.timeout:600}")
private int timeout;
@Autowired
StartPlatformTokenService startPlatformTokenService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......@@ -99,16 +96,8 @@ public class RegUnitInfoController extends BaseController {
@RequestParam String companyName) {
if (ValidationUtil.isEmpty(unitCode)) {
throw new BadRequest("单位编码不能为空");
}
if (!ValidationUtil.isEmpty(companyName)) {
startPlatformTokenService.getToken();
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName);
if(result.getResult()!=null)
{
throw new BadRequest("重复的公司名称");
}
}
RegUnitInfoDto regUnitInfoDto = iRegUnitInfoService.unitCheck(unitCode, unitType);
RegUnitInfoDto regUnitInfoDto = iRegUnitInfoService.unitCheck(unitCode, unitType,companyName);
return ResponseHelper.buildResponse(regUnitInfoDto);
}
......
......@@ -40,6 +40,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.BaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.StartPlatformTokenService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitIcDto;
......@@ -87,7 +88,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Autowired
AccessFeignService accessFeignService;
@Autowired
StartPlatformTokenService startPlatformTokenService;
/**
* 使用单位的类型,数据来源:cb_data_dictionary code = 1232
*/
......@@ -218,13 +221,31 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
}
@Override
public RegUnitInfoDto unitCheck(String unitCode, String unitType) {
public RegUnitInfoDto unitCheck(String unitCode, String unitType,String companyName) {
if (!ValidationUtil.isEmpty(companyName)) {
startPlatformTokenService.getToken();
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName);
if(result.getResult()!=null)
{
throw new BadRequest("重复的公司名称");
}
}
if (!ValidationUtil.isEmpty(unitCode)) {
startPlatformTokenService.getToken();
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyCode(unitCode);
if(result.getResult()!=null)
{
throw new RuntimeException("重复的公司编码");
}
}
// 1.校验重复性
RegUnitInfo regUnitInfo = this
.getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
if (regUnitInfo != null) {
throw new RuntimeException("该单位已注册,请联系企业管理员!");
}
// RegUnitInfo regUnitInfo = this
// .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
// if (regUnitInfo != null) {
// throw new RuntimeException("该单位已注册,请联系企业管理员!");
// }
// 2.组织返回数据
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
if (USE_UNIT_TYPE_CODE.equals(unitType) || PRODUCT_UNIT_TYPE_CODE.equals(unitType) || FILLING_UNIT_TYPE_CODE.equals(unitType)) {
......
package com.yeejoin.amos.boot.module.ugp.api.Enum;
public enum ProjectInitiationEnum {
import java.util.HashMap;
import java.util.Map;
启动流程("启动流程", "/workflow/task/startTask", ""),
流程详情("流程详情", "/workflow/task/{taskId}", "taskId"),
合并启动流程("合并启动流程", "/workflow/task/startProcess", ""),
所有已执行任务详情("所有已执行任务详情","/workflow/activitiHistory/task/detail/{taskId}","taskId"),
流程任务("流程任务", "/workflow/task?processInstanceId={processInstanceId}", "processInstanceId"),
我的代办("我的代办", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
我的代办有ID("我的代办有ID", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
已执行任务("已执行任务", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
已执行任务有ID("已执行任务有ID", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
启动免登录流程("启动免登录流程", "/processes/{appKey}", "appKey"),
当前节点("当前节点", "/wf/taskstodo?processInstanceId={processInstanceId}", "processInstanceId"),
执行流程("执行流程", "/workflow/task/pickupAndCompleteTask/{taskId}", "taskId"),
终止流程("终止流程", "/wf/processes/{processInstanceId}?deleteReason={deleteReason}", "processInstanceId,deleteReason"),
当前子节点("当前子节点", "/wf/processes/{processInstanceId}/tasks?taskDefinitionKey={taskDefinitionKey}", "processInstanceId,taskDefinitionKey"),
工作流流水("工作流流水","/wf/processes/{processInstanceId}/tasks", "processInstanceId"),
子节点信息("子节点信息","/workflow/task/list/all/{instanceId}", "instanceId");
private String desc;
private String uri;
private String params;
ProjectInitiationEnum(String desc, String uri, String params) {
this.desc = desc;
this.uri = uri;
this.params = params;
public enum ProjectInitiationEnum {
项目立项("1","项目立项"),
平台审核("2","平台审核"),
告知申请("3","告知申请"),
接受告知("4","接受告知"),
审查项目("5","审查项目"),
提交资料("6","提交资料"),
审批人审批("7","审批人审批"),
审核人审核("8","审核人审核"),
监检科室分配("9","监检科室分配"),
监检员分配("10","监检员分配"),
监检员审核("11","监检员审核"),
项目关闭("12","项目关闭"),
接受审查意见("13","接受审查意见");
private String status;
private String name;
public static Map<String,String> getNameByStatusMap = new HashMap<String,String>();
public static Map<String,String> getStatusByNameMap = new HashMap<String,String>();
static {
for(ProjectInitiationEnum projectInitiationEnum:ProjectInitiationEnum.values()){
getNameByStatusMap.put(projectInitiationEnum.status,projectInitiationEnum.name);
getStatusByNameMap.put(projectInitiationEnum.name, projectInitiationEnum.status);
}
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
ProjectInitiationEnum(String status, String name) {
this.status = status;
this.name = name;
}
public String getUri() {
return uri;
public String getStatus() {
return status;
}
public void setUri(String uri) {
this.uri = uri;
public void setStatus(String status) {
this.status = status;
}
public String getParams() {
return params;
public String getName() {
return name;
}
public void setParams(String params) {
this.params = params;
public void setName(String name) {
this.name = name;
}
}
package com.yeejoin.amos.boot.module.ugp.api.Enum;
import java.util.HashMap;
import java.util.Map;
public enum ProjectResourceEnum {
焊工资源("焊工","welder"),
设备资源("设备","equipment"),
管材资源("管材","material");
private String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
ProjectResourceEnum(String status, String state) {
this.status = status;
this.state = state;
}
private String state;
public static final Map<String,String> map=new HashMap<>();
static {
for (ProjectResourceEnum projectResourceEnum:ProjectResourceEnum.values()){
map.put(projectResourceEnum.status, projectResourceEnum.state);
}
}
}
package com.yeejoin.amos.boot.module.ugp.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Author cpp
* @Description
* @Date 2022/10/10
*/
@Data
public class PercentOfPassDto extends BaseDto {
@ApiModelProperty(value = "项目id")
private Long projectId;
@ApiModelProperty(value = "合格率")
private String percentOfPass;
@ApiModelProperty(value = "监理单位")
private String currentUnit;
@ApiModelProperty(value = "项目名称")
private String name;
@ApiModelProperty(value = "项目地点")
private String address;
@ApiModelProperty(value = "项目进度")
private String progressStatus;
@ApiModelProperty(value = "建设单位名称")
private String constructionUnit;
@ApiModelProperty(value = "建设单位负责人名称")
private String chargePerson;
@ApiModelProperty(value = "项目开工日期")
private Date startDate;
@ApiModelProperty(value = "项目提交日期")
private Date submitDate;
@ApiModelProperty(value = "刷新")
private String refresh;
}
package com.yeejoin.amos.boot.module.ugp.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.awt.*;
import java.util.Date;
/**
* 焊口信息表
*
* @author system_generator
* @date 2022-09-22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="WelderDto", description="焊工表")
public class WelderDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "焊工姓名")
private String name;
@ApiModelProperty(value = "身份证号码")
private String idNumber;
@ApiModelProperty(value = "联系电话")
private String phone;
@ApiModelProperty(value = "持证项目")
private String licensedProject;
@ApiModelProperty(value = "证书编号")
private String certNumber;
@ApiModelProperty(value = "发证部门")
private String licenseDept;
@ApiModelProperty(value = "证书有效期")
private Date certValidDate;
@ApiModelProperty(value = "常用地址")
private String address;
@ApiModelProperty(value = "证书类型")
private String certType;
@ApiModelProperty(value = "考试机构")
private String examOrg;
@ApiModelProperty(value = "持证批次")
private String licensedNum;
@ApiModelProperty(value = "档案编号")
private String fileNumber;
@ApiModelProperty(value = "图片")
private Image image;
}
......@@ -100,4 +100,16 @@ public class Company extends BaseEntity {
@TableField("org_code")
private String orgCode;
/**
* 企业管理员
*/
@TableField("admin")
private String admin;
/**
* 企业管理员电话
*/
@TableField("admin_phone")
private String adminPhone;
}
......@@ -23,7 +23,7 @@ public class QualityInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 企业id
* 项目id
*/
@TableField("project_id")
private Long projectId;
......@@ -40,4 +40,8 @@ public class QualityInfo extends BaseEntity {
@TableField("supervisory_unit_id")
private Long supervisoryUnitId;
//项目表
private Project project;
}
package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.ugp.api.dto.PercentOfPassDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.QualityInfo;
import java.util.List;
public interface IInstallationQualityMapper extends BaseMapper<QualityInfo> {
List<QualityInfo> findss();
}
package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 焊口信息表 Mapper 接口
......@@ -9,6 +14,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author system_generator
* @date 2022-09-22
*/
@Mapper
public interface WeldMapper extends BaseMapper<Weld> {
@Select ("select project_id,super_inspec_status from tz_ugp_weld where project_id =#{projectId}")
List<WeldDto> select(Long projectId);
}
package com.yeejoin.amos.boot.module.ugp.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.PercentOfPassDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import java.util.List;
public interface IInstallationQualityService {
Page<PercentOfPassDto> find(Page<PercentOfPassDto> page,PercentOfPassDto percentOfPassDto);
}
package com.yeejoin.amos.boot.module.ugp.api.service;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
public interface IProjectInitiationService {
......@@ -9,7 +10,7 @@ public interface IProjectInitiationService {
* @return 返回instanceId ,加入项目信息表中
* @throws Exception
*/
String start(Object objectd);
void start(Project project);
/**
* 执行流程节点,并记录日志
......
package com.yeejoin.amos.boot.module.ugp.api.service;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import java.util.List;
......@@ -12,5 +12,5 @@ import java.util.List;
* @date 2022-09-22
*/
public interface IWeldService {
void getCode(Long projectCode, int number) throws Exception;
List<Weld> getCode(Long projectCode, int number);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ugp.api.mapper.IInstallationQualityMapper">
<resultMap id="result" type="com.yeejoin.amos.boot.module.ugp.api.entity.QualityInfo">
<result property="projectId" column="project_id" jdbcType="INTEGER"/>
<result property="supervisoryUnitId" column="supervisory_unit_id" jdbcType="INTEGER"/>
<association property="project" javaType="com.yeejoin.amos.boot.module.ugp.api.entity.Project" >
<!--@Table tz_ugp_project-->
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="progressStatus" column="progress_status" jdbcType="VARCHAR"/>
<result property="address" column="address" jdbcType="VARCHAR"/>
<result property="startDate" column="start_date" jdbcType="OTHER"/>
<result property="constructionUnit" column="construction_unit" jdbcType="VARCHAR"/>
<result property="chargePerson" column="charge_person" jdbcType="VARCHAR"/>
<result property="submitDate" column="submit_date" jdbcType="OTHER"/>
</association>
</resultMap>
<select id="findss" resultMap="result">
select
pt.name ,
pt.address ,
pt.progress_status ,
qy.supervisory_unit_id ,
qy.project_id,
pt.construction_unit ,
pt.charge_person ,
pt.start_date ,
pt.submit_date
from
tz_ugp_quality_info qy ,
tz_ugp_project pt
where
qy.project_id=pt.sequence_nbr
and
qy.is_delete =0
and
pt.is_delete=0
</select>
</mapper>
\ No newline at end of file
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
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.CompanyModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -11,9 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.CompanyServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -41,6 +53,13 @@ public class CompanyController extends BaseController {
CompanyServiceImpl companyServiceImpl;
@Autowired(required = false)
CompanyMapper companyMapper;
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
OrgServiceImpl orgServiceImpl;
@Value("${amos.secret.key}")
String secretKey;
/**
* 新增企业信息表
......@@ -157,11 +176,71 @@ public class CompanyController extends BaseController {
// company= companyMapper.selectOne(lambdaQueryWrapper);
return ResponseHelper.buildResponse(companyMapper.selectById(companyList));
}
/**
* 企业审核
* 根据sequenceNbr更新,审核通过后的企业调用平台接口创建单位及管理员,并存业务的cb_org_usr表
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "check")
@ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新,并创建单位及管理员", notes = "根据sequenceNbr更新,并创建单位及管理员")
public ResponseModel<Boolean> companyCheck(@RequestBody CompanyDto model,Long sequenceNbr,String bizOrgType) throws Exception{
Company company = companyServiceImpl.getById(sequenceNbr);
company.setApproved(model.getApproved());
if (company.getApproved().equals("已审核")){
final CompanyModel companyModel = new CompanyModel();
final AgencyUserModel agencyUserModel = new AgencyUserModel();
//创建平台企业
companyModel.setCompanyName(company.getName());
companyModel.setCompanyCode(company.getCreditCode());
companyModel.setAddress(company.getAddress());
companyModel.setParentId(0L);
companyModel.setLevel("headquarter");
companyModel.setAgencyCode("ugp");
final CompanyModel companyModelFeignClient = Privilege.companyClient.create(companyModel).getResult();
//创建平台用户
String admin = company.getAdmin();
String adminPhone = company.getAdminPhone();
agencyUserModel.setRealName(admin);
agencyUserModel.setMobile(company.getContactPhone());
agencyUserModel.setAgencyCode("ugp");
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setMobile(adminPhone);
agencyUserModel.setCreateTime(new Date());
agencyUserModel.setUserName(admin);
agencyUserModel.setPassword(DesUtil.encode(adminPhone, secretKey));
agencyUserModel.setRePassword(DesUtil.encode(adminPhone, secretKey));
Privilege.agencyUserClient.create(agencyUserModel);
//企业动态表单存储
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(company));
jsonObject.put("amosOrgId",companyModelFeignClient.getSequenceNbr());
jsonObject.put("amosOrgCode",companyModelFeignClient.getOrgCode());
orgServiceImpl.dataHandling(jsonObject,bizOrgType,null);
//企业管理员人员 动态表单存储
jsonObject = null;
jsonObject.put("name",admin);
jsonObject.put("phone",adminPhone);
orgServiceImpl.dataHandling(jsonObject, OrgPersonEnum.企业管理员.getKey(),null);
}
return ResponseHelper.buildResponse(companyServiceImpl.updateById(company));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "test")
@ApiOperation(httpMethod = "Post", value = "根据sequenceNbr更新,并创建单位及管理员", notes = "根据sequenceNbr更新,并创建单位及管理员")
public ResponseModel<OrgUsrDto> getInfo(@RequestBody JSONObject jsonObject, String bizOrgType,String sequenceNbr){
return ResponseHelper.buildResponse(orgServiceImpl.dataHandling(jsonObject,bizOrgType,sequenceNbr));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.EquipmentServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
......@@ -37,28 +42,28 @@ public class EquipmentController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增设备信息表", notes = "新增设备信息表")
public ResponseModel<EquipmentDto> save(@RequestBody EquipmentDto model) {
model = equipmentServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增设备信息表", notes = "新增设备信息表")
public ResponseModel<EquipmentDto> save(@RequestBody EquipmentDto model) {
model = equipmentServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新设备信息表", notes = "根据sequenceNbr更新设备信息表")
public ResponseModel<EquipmentDto> updateBySequenceNbrEquipment(@RequestBody EquipmentDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentServiceImpl.updateWithModel(model));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新设备信息表", notes = "根据sequenceNbr更新设备信息表")
public ResponseModel<EquipmentDto> updateBySequenceNbrEquipment(@RequestBody EquipmentDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentServiceImpl.updateWithModel(model));
}
/**
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
......@@ -67,50 +72,62 @@ public class EquipmentController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除设备信息表", notes = "根据sequenceNbr删除设备信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个设备信息表", notes = "根据sequenceNbr查询单个设备信息表")
public ResponseModel<EquipmentDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentServiceImpl.queryBySeq(sequenceNbr));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个设备信息表", notes = "根据sequenceNbr查询单个设备信息表")
public ResponseModel<EquipmentDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentServiceImpl.queryBySeq(sequenceNbr));
}
/**
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "设备信息表分页查询", notes = "设备信息表分页查询")
public ResponseModel<Page<EquipmentDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EquipmentDto> page = new Page<EquipmentDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentPage(page));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "设备信息表分页查询", notes = "设备信息表分页查询")
public ResponseModel<Page<EquipmentDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) {
Page<EquipmentDto> page = new Page<EquipmentDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentPage(page));
}
/**
* 列表全部数据查询
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "设备信息表列表全部数据查询", notes = "设备信息表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentList());
}
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备信息表列表全部数据查询", notes = "设备信息表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentList());
}
/**
* 设备数据名称查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "设备数据名称查询", notes = "设备数据名称查询")
@GetMapping(value = "/selectName")
public ResponseModel<List<JSONObject>> selectName(@RequestParam(value = "unitId")String installationUnitId) {
return ResponseHelper.buildResponse(equipmentServiceImpl.selectName(installationUnitId));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticeDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticePageDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.PercentOfPassDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import com.yeejoin.amos.boot.module.ugp.api.service.IInstallationQualityService;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.InstallationQualityImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.WeldServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import javax.annotation.Resource;
import java.util.List;
/**
* 质量问题闭环管理-安装质量监检信息-质量监检信息
*
* @author system_generator
* @date 2022-10-09
*/
@RestController
@Api(tags = "质量问题闭环管理-安装质量监检信息-质量监检信息Api")
@RequestMapping(value = "/install-quality")
public class InstallationQualityController extends BaseController {
@Resource
private InstallationQualityImpl services;
@Resource
private WeldServiceImpl weld;
//查看质量监检信息
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/find")
@ApiOperation(httpMethod = "GET", value = "质量问题闭环管理-安装质量监检信息-质量监检信息", notes = "质量问题闭环管理-安装质量监检信息-质量监检信息")
public ResponseModel<Page<PercentOfPassDto>> find(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size,PercentOfPassDto percentOfPassDto) {
Page<PercentOfPassDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(services.find(page,percentOfPassDto));
}
//通过projectId查询焊口信息
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/selectByProjectId/{projectId}")
@ApiOperation(httpMethod = "get", value = "焊口信息", notes = "焊口信息")
public ResponseModel<List<WeldDto>> selectByProjectId(@PathVariable("projectId") Long projectId) {
if (projectId == null) {
return null;
}
return ResponseHelper.buildResponse(weld.getProjectId (projectId));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -113,4 +114,29 @@ public class MaterialController extends BaseController {
public ResponseModel<List<MaterialDto>> selectForList() {
return ResponseHelper.buildResponse(materialServiceImpl.queryForMaterialList());
}
// /**
// * 根据项目id查询材料信息
// *
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(httpMethod = "GET",value = "根据项目id查询材料信息", notes = "根据项目id查询材料信息")
// @GetMapping(value = "/selectMess")
// public ResponseModel<MaterialDto> selectMess(@RequestParam String companyId ) {
// return ResponseHelper.buildResponse(materialServiceImpl.selectMess(companyId));
// }
/**
* 材料信息表列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "材料信息表列表全部数据查询", notes = "材料信息表列表全部数据查询")
@GetMapping(value = "/selectName")
public ResponseModel<List<JSONObject>> selectName(@RequestParam(value = "unitId")String installationUnitId) {
return ResponseHelper.buildResponse(materialServiceImpl.selectName(installationUnitId));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProjectInitiationServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -35,6 +40,8 @@ public class ProjectController extends BaseController {
ProjectServiceImpl projectServiceImpl;
@Autowired
ProjectInitiationServiceImpl projectInitiationService;
@Autowired
OrgServiceImpl orgServiceImpl;
/**
* 新增项目信息表
......@@ -48,6 +55,9 @@ public class ProjectController extends BaseController {
model.setStartDate(new Date());
model.setSubmitDate(new Date());
model = projectServiceImpl.createWithModel(model);
Project project = new Project();
BeanUtils.copyProperties(model, project);
projectInitiationService.start(project);
return ResponseHelper.buildResponse(model);
}
......@@ -124,4 +134,25 @@ public class ProjectController extends BaseController {
public ResponseModel<List<ProjectDto>> selectForList() {
return ResponseHelper.buildResponse(projectServiceImpl.queryForProjectList());
}
/**
* 查询项目名称
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "查询项目名称", notes = "查询项目名称")
@GetMapping(value = "/selectName")
public ResponseModel<List<JSONObject>> selectName() {
return ResponseHelper.buildResponse(projectServiceImpl.selectName());
}
/**
* 获取下拉选择值
* @param type CHARGE("建设单位负责人")、INSTALL("安装单位")、DESIGN("设计单位")
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "查询下拉选择框的值", notes = "查询下拉选择框的值")
@GetMapping(value = "/getSelectInfo")
public ResponseModel<List<OrgUsr>> getSelectInfo(String type){
return ResponseHelper.buildResponse(orgServiceImpl.getSelectInfo(type));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProjectInitiationServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -24,7 +25,8 @@ public class ProjectInitiationController {
@GetMapping(value = "/start")
@ApiOperation(httpMethod = "GET", value = "流程启动", notes = "流程启动")
public ResponseModel<String> start() throws Exception {
return ResponseHelper.buildResponse(projectInitiationServiceImpl.start(new Object()));
projectInitiationServiceImpl.start(new Project());
return ResponseHelper.buildResponse("ok");
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -113,4 +115,16 @@ public class ProjectResourceController extends BaseController {
public ResponseModel<List<ProjectResourceDto>> selectForList() {
return ResponseHelper.buildResponse(projectResourceServiceImpl.queryForProjectResourceList());
}
/**
* 绑定设备跟项目
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "POST",value = "绑定设备跟项目", notes = "绑定设备跟项目")
@PostMapping(value = "/saveId")
public ResponseModel<ProjectResource> saveId(@RequestBody JSONObject jsonObject) {
return ResponseHelper.buildResponse(projectResourceServiceImpl.saveIds(jsonObject));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -90,7 +91,7 @@ public class WeldController extends BaseController {
}
/**
* 列表分页查询
* 列表分页查询+条件查询
*
* @param current 当前页
* @param current 每页大小
......@@ -100,8 +101,9 @@ public class WeldController extends BaseController {
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "焊口信息表分页查询", notes = "焊口信息表分页查询")
public ResponseModel<Page<WeldDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) {
return ResponseHelper.buildResponse(weldServiceImpl.queryForWeldPage(current, size));
(value = "size") int size,String projectId) {
return ResponseHelper.buildResponse(weldServiceImpl.queryForWeldPage(current, size,projectId));
}
/**
......@@ -122,11 +124,11 @@ public class WeldController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "POST", value = "生成焊口编码", notes = "生成焊口编码")
@PostMapping(value = "/getCode")
public synchronized ResponseModel<String> getCode(Long sequenceNbr, int number) throws Exception {
weldServiceImpl.getCode(sequenceNbr, number);
return ResponseHelper.buildResponse("ok");
@ApiOperation(httpMethod = "GET", value = "生成焊口编码", notes = "生成焊口编码")
@GetMapping(value = "/getCode")
public ResponseModel<List<Weld>> getCode(Long sequenceNbr, int number) {
return ResponseHelper.buildResponse(weldServiceImpl.getCode(sequenceNbr,number));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@Api(tags = "焊工信息")
@RequestMapping(value = "/welder")
public class WelderController extends BaseController {
/**
* 新增焊工信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/saveWelder", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增焊工信息", notes = "新增焊工信息")
public ResponseModel<Object> saveWelder(@RequestParam String isWelder, @RequestBody WelderDto welderDto) {
return ResponseHelper.buildResponse(null);
}
}
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import org.springframework.beans.factory.annotation.Autowired;
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.List;
import java.util.stream.Collectors;
/**
* 设备信息表服务实现类
......@@ -16,18 +22,44 @@ import java.util.List;
* @date 2022-09-22
*/
@Service
public class EquipmentServiceImpl extends BaseService<EquipmentDto,Equipment,EquipmentMapper> implements IEquipmentService {
public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, EquipmentMapper> implements IEquipmentService {
@Autowired
EquipmentMapper equipmentMapper;
/**
* 分页查询
*/
public Page<EquipmentDto> queryForEquipmentPage(Page<EquipmentDto> page) {
public Page<EquipmentDto> queryForEquipmentPage(Page<EquipmentDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<EquipmentDto> queryForEquipmentList() {
return this.queryForList("" , false);
public List<EquipmentDto> queryForEquipmentList() {
return this.queryForList("", false);
}
/**
* 设备数据名称查询
*
* @return
*/
public List<JSONObject> selectName(String installationUnitId) {
List<JSONObject> names = new ArrayList<>();
//添加查询条件
QueryWrapper<Equipment> wrapper = new QueryWrapper<>();
wrapper.eq("company_id", installationUnitId);
List<Equipment> equipment = equipmentMapper.selectList(wrapper);
for (Equipment i : equipment) {
JSONObject name = new JSONObject();
name.put("name", i.getName());
name.put("company_id", i.getCompanyId());
names.add(name);
}
return names;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.ugp.api.dto.PercentOfPassDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.QualityInfo;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import com.yeejoin.amos.boot.module.ugp.api.mapper.IInstallationQualityMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IInstallationQualityService;
import jdk.nashorn.internal.runtime.logging.Logger;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author cpp
* @Description
* @Date 2022/10/10
*/
@Service
public class InstallationQualityImpl extends BaseService<PercentOfPassDto, QualityInfo, IInstallationQualityMapper> implements IInstallationQualityService {
@Resource
private IInstallationQualityMapper mapper;
@Resource
private WeldServiceImpl weldService;
@Resource
private OrgUsrServiceImpl orgUsrService;
//分页查询项目质量监检信息
@Override
public Page<PercentOfPassDto> find(Page<PercentOfPassDto> page,PercentOfPassDto pd) {
String name = pd.getName( );
List<QualityInfo> qfList = mapper.findss ( );
List<PercentOfPassDto> list = new ArrayList<> ( );
for (QualityInfo qualityInfo : qfList) {
PercentOfPassDto percentOfPassDto = new PercentOfPassDto ( );
percentOfPassDto.setName (qualityInfo.getProject ( ).getName ( ));
percentOfPassDto.setAddress (qualityInfo.getProject ( ).getAddress ( ));
percentOfPassDto.setProgressStatus (qualityInfo.getProject ( ).getProgressStatus ( ));
percentOfPassDto.setProjectId (qualityInfo.getProjectId ( ));
percentOfPassDto.setChargePerson (qualityInfo.getProject ( ).getChargePerson ( ));
//获取监理单位的id
Long supervisoryUnitId = qualityInfo.getSupervisoryUnitId ( );
//调用接口
try {
OrgUsrFormDto orgUsrFormDto = orgUsrService.selectCompanyById (supervisoryUnitId);
String currentUnit = orgUsrFormDto.getCurrentUnit ( );
percentOfPassDto.setCurrentUnit (currentUnit);
} catch (Exception e) {
e.printStackTrace ( );
}
percentOfPassDto.setStartDate (qualityInfo.getProject ( ).getStartDate ( ));
percentOfPassDto.setConstructionUnit (qualityInfo.getProject ( ).getConstructionUnit ( ));
percentOfPassDto.setSubmitDate (qualityInfo.getProject ( ).getSubmitDate ( ));
list.add (percentOfPassDto);
}
//创建新的集合来存放数据
List<PercentOfPassDto> newsData = new ArrayList<> ( );
if (list != null && list.size ( ) > 0) {
//遍历数据
for (PercentOfPassDto pr : list) {
//获取项目id
Long projectId = pr.getProjectId ( );
//通过项目id查询焊口数据
List<WeldDto> weldDtoList = weldService.getProjectId (projectId);
if (weldDtoList != null && weldDtoList.size ( ) > 0) {
//获取焊口信息总条数
int sum = weldDtoList.size ( );
//焊口合格数
int qualifiedData = 0;
for (WeldDto weldDto : weldDtoList) {
String superInspecStatus = weldDto.getSuperInspecStatus ( );
if (superInspecStatus.equals ("合格")) {
qualifiedData++;
}
}
//合格率
BigDecimal sums = new BigDecimal (sum);
BigDecimal qualifiedDatas = new BigDecimal (qualifiedData);
Double pass = qualifiedDatas.divide (sums, 2, BigDecimal.ROUND_HALF_UP).multiply (new BigDecimal (100)).doubleValue ( );
//转换成百分比,生成合格率
String fpy = pass.toString ( ) + "%";
//将合格率赋值给数据集合
pr.setPercentOfPass (fpy);
//将数据添加到新集合里面
newsData.add (pr);
}
}
//name不为空走条件筛选
if (!StringUtils.isEmpty(name)) {
//进行数据筛选
List<PercentOfPassDto> collect = newsData.stream ( ).filter (b -> b.getName ( ).equals (name)).collect (Collectors.toList ( ));
page.setRecords (collect);
page.setTotal (collect.size ());
return page;
}else {
//如果条件name为空的,直接查询全部
page.setRecords (newsData);
page.setTotal (newsData.size ());
return page;
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.MaterialDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Material;
import com.yeejoin.amos.boot.module.ugp.api.mapper.MaterialMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IMaterialService;
import com.yeejoin.amos.boot.module.ugp.api.dto.MaterialDto;
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.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -16,18 +21,40 @@ import java.util.List;
* @date 2022-09-22
*/
@Service
public class MaterialServiceImpl extends BaseService<MaterialDto,Material,MaterialMapper> implements IMaterialService {
public class MaterialServiceImpl extends BaseService<MaterialDto, Material, MaterialMapper> implements IMaterialService {
/**
* 分页查询
*/
public Page<MaterialDto> queryForMaterialPage(Page<MaterialDto> page) {
public Page<MaterialDto> queryForMaterialPage(Page<MaterialDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<MaterialDto> queryForMaterialList() {
return this.queryForList("" , false);
public List<MaterialDto> queryForMaterialList() {
return this.queryForList("", false);
}
/**
* 获取材料名称跟企业id
*/
public List<JSONObject> selectName(String installationUnitId) {
List<JSONObject> names = new ArrayList<>();
//添加查询条件
QueryWrapper<Material> wrapper = new QueryWrapper<>();
wrapper.eq("company_id", installationUnitId);
List<Material> materials = baseMapper.selectList(wrapper);
for (Material i : materials) {
JSONObject name = new JSONObject();
name.put("name", i.getName());
name.put("company_id", i.getCompanyId());
names.add(name);
}
return names;
}
}
\ No newline at end of file
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.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......@@ -14,6 +17,7 @@ import com.yeejoin.amos.boot.module.ugp.api.Util.HttpUtil;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectInitiationDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.InstallNoticeMsg;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectInitiation;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectInitiationMapper;
......@@ -46,6 +50,12 @@ import java.util.*;
@Service
public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationDto, ProjectInitiation, ProjectInitiationMapper> implements IProjectInitiationService {
@Autowired
ProjectInitiationServiceImpl projectInitiationService;
@Autowired
WorkflowExcuteServiceImpl workflowExcuteService;
......@@ -61,6 +71,9 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
@Autowired
SuperviseRuleServiceImpl superviseRuleServiceImpl;
@Autowired
ProjectServiceImpl projectService;
private final Logger logger = LoggerFactory.getLogger(ProjectInitiationServiceImpl.class);
@Value("${params.work.flow.processDefinitionKey}")
......@@ -70,8 +83,9 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
@Override
@Transactional(rollbackFor = Exception.class)
public String start(Object objectd) {
public void start(Project project) {
String instanceId = null;
//启动流程
try {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(processDefinitionKey);
......@@ -86,14 +100,17 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
e.printStackTrace();
System.out.println("流程启动失败:"+e.getMessage());
}
//新增project表的流程id和流程状态
project.setInstanceId(instanceId);
project.setStatus(getFlowTaskName(instanceId));
projectService.updateById(project);
//审核条件
String option = "0";
if (true) {
option = "1";
}
//执行审核流程
execute(instanceId, objectd,option);
return instanceId;
//执行项目立项流程
execute(instanceId,project,option);
}
@Override
......@@ -107,28 +124,23 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
JSONObject dataObject = jsonObject.getJSONObject("data");
projectInitiation.setTaskId(dataObject.getString("id"));
projectInitiation.setTaskName(dataObject.getString("name"));
TaskResultDTO dto = new TaskResultDTO();
dto.setResult(option);
dto.setResultCode("condition");
dto.setTaskId(projectInitiation.getTaskId());
HashMap<String, Object> var = new HashMap<>();
var.put("condition", option);
dto.setVariable(var);
if ("平台审核".equals(dataObject.getString("name"))) {
System.out.println();
if (ProjectInitiationEnum.平台审核.getName().equals(dataObject.getString("name"))) {
if (true) {
option = "1";
}
}
if("监检员审核".equals(dataObject.getString("name"))){
if(ProjectInitiationEnum.监检员审核.getName().equals(dataObject.getString("name"))){
if("1".equals(option)){
projectInitiation.setTaskName(dataObject.getString("name")+"(流程结束!)");
}
}
if("接受审查意见".equals(dataObject.getString("name"))){
if(ProjectInitiationEnum.接受审查意见.getName().equals(dataObject.getString("name"))){
projectInitiation.setTaskName(dataObject.getString("name")+"(流程结束!)");
}
if ("告知申请".equals(dataObject.getString("name"))) {
if (ProjectInitiationEnum.告知申请.getName().equals(dataObject.getString("name"))) {
if(!ValidationUtil.isEmpty(objectd)) {
//设置短信发送的基本参数
HashMap<String, String> smsParams = new HashMap();
......@@ -166,11 +178,24 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
}
try {
//组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResult(option);
dto.setResultCode("condition");
dto.setTaskId(projectInitiation.getTaskId());
HashMap<String, Object> var = new HashMap<>();
var.put("condition", option);
dto.setVariable(var);
//执行流程
Workflow.taskClient.completeByTask(projectInitiation.getTaskId(),dto);
//保存日志
this.save(projectInitiation);
} catch (Exception e) {
e.printStackTrace();
System.out.println("任务完成失败:"+e.getMessage());
} finally {
//更新project种的status字段,表示当前流程下一个执行的任务
updateProjectFlowStatus(instanceId);
}
}
......@@ -185,4 +210,25 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
}
return smsRecordModel;
}
/**
* 获取流程当前任务名称
* @param instanceId
* @return
*/
public String getFlowTaskName(String instanceId){
JSONObject jsonObject = workflowFeignService.getTask(instanceId);
if (ValidationUtil.isEmpty(jsonObject)) {
return "";
}
return jsonObject.getJSONObject("data").getString("name");
}
public void updateProjectFlowStatus(String instanceId){
LambdaQueryWrapper<Project> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Project::getInstanceId,instanceId);
Project project = projectService.getOne(wrapper);
project.setStatus(getFlowTaskName(instanceId));
projectService.updateById(project);
}
}
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.module.ugp.api.Enum.ProjectResourceEnum;
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.api.service.IProjectResourceService;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectResourceDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum.*;
/**
* 项目资源表(包括焊工、管材、设备)服务实现类
......@@ -16,18 +27,55 @@ import java.util.List;
* @date 2022-09-22
*/
@Service
public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,ProjectResource,ProjectResourceMapper> implements IProjectResourceService {
public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto, ProjectResource, ProjectResourceMapper> implements IProjectResourceService {
@Autowired
EquipmentMapper equipmentMapper;
@Autowired
ProjectResourceMapper projectResourceMapper;
/**
* 分页查询
*/
public Page<ProjectResourceDto> queryForProjectResourcePage(Page<ProjectResourceDto> page) {
public Page<ProjectResourceDto> queryForProjectResourcePage(Page<ProjectResourceDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<ProjectResourceDto> queryForProjectResourceList() {
return this.queryForList("" , false);
public List<ProjectResourceDto> queryForProjectResourceList() {
return this.queryForList("", false);
}
/**
* 存储项目设备关系
*/
public ProjectResource saveIds(JSONObject jsonObject) {
JSONArray subForm = jsonObject.getJSONArray("subForm");
ProjectResource projectResource = new ProjectResource();
for (Object json2 : subForm) {
String select = JSON.parseObject(JSON.toJSONString(json2)).getString("select");
String companyId = jsonObject.getString("company_id");
String type = jsonObject.getString("type");
if (type.equals(设备资源.getStatus())) {
projectResource.setType(设备资源.getState());
}
if (type.equals(焊工资源.getStatus())) {
projectResource.setType(焊工资源.getState());
}
if (type.equals(管材资源.getStatus())) {
projectResource.setType(管材资源.getState());
}
projectResource.setProjectId(Long.valueOf(companyId));
projectResource.setResourceId(Long.valueOf(select));
this.save(projectResource);
}
return projectResource;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IProjectInitiationService;
import com.yeejoin.amos.boot.module.ugp.api.service.IProjectService;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -20,22 +20,38 @@ import java.util.List;
* @date 2022-09-22
*/
@Service
public class ProjectServiceImpl extends BaseService<ProjectDto,Project,ProjectMapper> implements IProjectService {
public class ProjectServiceImpl extends BaseService<ProjectDto, Project, ProjectMapper> implements IProjectService {
@Autowired
ProjectMapper projectMapper;
/**
* 分页查询
*/
public Page<ProjectDto> queryForProjectPage(Page<ProjectDto> page,String name, String constructionUnit) {
return this.queryForPage(page, null, false,name, constructionUnit);
public Page<ProjectDto> queryForProjectPage(Page<ProjectDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<ProjectDto> queryForProjectList() {
return this.queryForList("" , false);
public List<ProjectDto> queryForProjectList() {
return this.queryForList("", false);
}
/**
* 查询项目名称
*/
public List<JSONObject> selectName() {
List<JSONObject> names = new ArrayList<>();
//查询所有项目
List<Project> projects = projectMapper.selectList(null);
for (Project i : projects) {
JSONObject name = new JSONObject();
name.put("name", i.getName());
name.put("company_id", i.getCompanyId());
names.add(name);
}
return names;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.Enum.WeldCodeEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.WeldMethodEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.WeldMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IWeldService;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
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.rdbms.service.BaseService;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 焊口信息表服务实现类
......@@ -42,14 +36,13 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
ProjectMapper projectMapper;
Logger logger = LoggerFactory.getLogger(WeldServiceImpl.class);
// Logger logger = LoggerFactory.getLogger(WeldServiceImpl.class);
/**
* 分页查询
*/
public Page<WeldDto> queryForWeldPage(int current, int size) {
public Page<WeldDto> queryForWeldPage(int current, int size, String projectId) {
Page<WeldDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
......@@ -57,18 +50,25 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
for (WeldDto weldDto : weldDtoPage.getRecords()) {
QueryWrapper<Project> wrapper = new QueryWrapper<>();
wrapper.eq("code", weldDto.getProjectId());
wrapper.eq("sequence_nbr", weldDto.getProjectId());
Project project = projectMapper.selectOne(wrapper);
weldDto.setName(project.getName());
QueryWrapper<Project> wrapperUnit = new QueryWrapper<>();
wrapperUnit.eq("installation_unit_id", weldDto.getInstallCompany());
List<Project> projects = projectMapper.selectList(wrapperUnit);
for (Project project1 : projects) {
weldDto.setInstallationUnit(project1.getInstallationUnit());
weldDto.setCodingStatus(WeldCodeEnum.map.get(weldDto.getCodingStatus()));
weldDto.setCodingMethod(WeldMethodEnum.map.get(weldDto.getCodingMethod()));
}
}
//如果不为空则过滤
if (projectId != null) {
List<WeldDto> L = weldDtoPage.getRecords().stream().filter(b -> b.getProjectId().equals(projectId)).collect(Collectors.toList());
weldDtoPage.setRecords(L);
}
return weldDtoPage;
......@@ -88,53 +88,52 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
private static final AtomicInteger atomicNum = new AtomicInteger();
// 初始化编号
private final int INIT_CODE_NUM = 0;
private final String FIRST_CHARACTER = "-HK";
public synchronized void getCode(Long sequenceNbr, int number) throws Exception {
public synchronized List<Weld> getCode(Long sequenceNbr, int number) {
List<Weld> welds = new ArrayList<>();
Project project = projectMapper.selectById(sequenceNbr);
QueryWrapper<Weld> wrapper = new QueryWrapper<>();
wrapper.eq("project_id", project.getCode()).orderByDesc("code").last("limit 1");
//根据seq查询条件判断是否已经存在该项目的该焊口编码
wrapper.eq("project_id", sequenceNbr).orderByDesc("code").last("limit 1");
Weld weld1 = weldMapper.selectOne(wrapper);
if (weld1 != null) {
String substring = weld1.getCode().substring(13, 17);
//存在时取后四位
String substring = weld1.getCode().substring(weld1.getCode().length() - 4, weld1.getCode().length());
atomicNum.set(Integer.parseInt(substring));
for (int i = 0; i < number; i++) {
Weld weld = new Weld();
String i1 = String.format("%04d", atomicNum.incrementAndGet());
String code = "XM" + (project.getCode()) + "-HK" + i1;
weld.setRegion(project.getAddress());
weld.setProjectId(Long.valueOf(project.getCode()));
weld.setInstallCompany(project.getInstallationUnitId());
weld.setCode(code);
weld.setRegion(project.getAddress());
weld.setCodingMethod("0");
weld.setCodingStatus("1");
weld.setCodingDate(new Date());
welds.add(weld);
}
saveBatch(welds);
} else {
atomicNum.set(0);
for (int i = 0; i < number; i++) {
Weld weld = new Weld();
String i1 = String.format("%04d", atomicNum.incrementAndGet());
String code = "XM" + (project.getCode()) + "-HK" + i1;
weld.setRegion(project.getAddress());
weld.setProjectId(Long.valueOf(project.getCode()));
weld.setInstallCompany(project.getInstallationUnitId());
weld.setCode(code);
weld.setRegion(project.getAddress());
weld.setCodingMethod("0");
weld.setCodingStatus("1");
weld.setCodingDate(new Date());
welds.add(weld);
}
saveBatch(welds);
//不存在时将atomicNum初始化
atomicNum.set(INIT_CODE_NUM);
}
for (int i = 0; i < number; i++) {
Weld weld = new Weld();
//生成四位数
String i1 = String.format("%04d", atomicNum.incrementAndGet());
//生成编码
String code = (project.getCode()) + FIRST_CHARACTER + i1;
weld.setRegion(project.getAddress());
weld.setProjectId(Long.valueOf(project.getSequenceNbr()));
weld.setInstallCompany(project.getInstallationUnitId());
weld.setCode(code);
weld.setRegion(project.getAddress());
weld.setCodingMethod(WeldMethodEnum.赋码方式1.getState());
weld.setCodingStatus(WeldCodeEnum.赋值状态2.getState());
weld.setCodingDate(new Date());
welds.add(weld);
}
saveBatch(welds);
return welds;
}
/**
* 通过项目多个id获取数据
* @param projectId
* @return
*/
public List<WeldDto> getProjectId(Long projectId){
return weldMapper.select(projectId);
}
}
\ No newline at end of file
......@@ -29,4 +29,5 @@ emqx.password=123456
fire-rescue=123
params.work.flow.processDefinitionKey=xiangmulixiangliucheng
\ No newline at end of file
params.work.flow.processDefinitionKey=xiangmulixiangliucheng
amos.secret.key=ugp
\ 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