Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
confg-server-api
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨阔
confg-server-api
Commits
5ddf32e1
Commit
5ddf32e1
authored
Sep 09, 2021
by
yangkuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加生成配置单接口
parent
9523aa56
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
869 additions
and
31 deletions
+869
-31
.gitignore
.gitignore
+2
-2
ConfiguratorV2Controller.java
...ch/authorization/controller/ConfiguratorV2Controller.java
+38
-4
StandardModelManageController.java
...thorization/controller/StandardModelManageController.java
+1
-1
SysUser.java
src/main/java/cn/com/uitech/authorization/pojo/SysUser.java
+18
-4
GenerateConfigurationOutputV2DTO.java
...m/uitech/config/dto/GenerateConfigurationOutputV2DTO.java
+22
-0
PostValidateOutputV2DTO.java
...ava/cn/com/uitech/config/dto/PostValidateOutputV2DTO.java
+18
-0
PostValidationInputV2DTO.java
...va/cn/com/uitech/config/dto/PostValidationInputV2DTO.java
+47
-0
BOMCVName.java
src/main/java/cn/com/uitech/config/entity/BOMCVName.java
+53
-0
MessageJson.java
src/main/java/cn/com/uitech/config/entity/MessageJson.java
+17
-0
ODRelation.java
src/main/java/cn/com/uitech/config/entity/ODRelation.java
+96
-0
ODRelationModel.java
...ain/java/cn/com/uitech/config/entity/ODRelationModel.java
+67
-0
ODRelationRepository.java
...cn/com/uitech/config/repository/ODRelationRepository.java
+13
-0
ConfiguratorCacheService.java
...n/com/uitech/config/service/ConfiguratorCacheService.java
+3
-4
ConfiguratorV2Service.java
...a/cn/com/uitech/config/service/ConfiguratorV2Service.java
+15
-2
ODDataService.java
...main/java/cn/com/uitech/config/service/ODDataService.java
+11
-3
OdService.java
src/main/java/cn/com/uitech/config/service/OdService.java
+6
-0
ConfiguratorCacheServiceImpl.java
...ech/config/service/impl/ConfiguratorCacheServiceImpl.java
+56
-0
ConfiguratorV2ServiceImpl.java
...uitech/config/service/impl/ConfiguratorV2ServiceImpl.java
+226
-8
ODDataServiceImpl.java
.../cn/com/uitech/config/service/impl/ODDataServiceImpl.java
+42
-3
OdServiceImpl.java
...java/cn/com/uitech/config/service/impl/OdServiceImpl.java
+103
-0
CheckODRelationOV.java
src/main/java/cn/com/uitech/config/vo/CheckODRelationOV.java
+15
-0
No files found.
.gitignore
View file @
5ddf32e1
...
...
@@ -29,4 +29,4 @@ build/
### VS Code ###
.vscode/
.clas
\ No newline at end of file
*.class
\ No newline at end of file
src/main/java/cn/com/uitech/
config
/controller/ConfiguratorV2Controller.java
→
src/main/java/cn/com/uitech/
authorization
/controller/ConfiguratorV2Controller.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
controller
;
package
cn
.
com
.
uitech
.
authorization
.
controller
;
import
cn.com.uitech.config.dto.BomInitializeInputV2DTO
;
import
cn.com.uitech.config.dto.BomInitializeOutputV2DTO
;
import
cn.com.uitech.config.dto.*
;
import
cn.com.uitech.config.service.ConfiguratorService
;
import
cn.com.uitech.config.service.ConfiguratorV2Service
;
import
cn.com.uitech.config.utils.BusinessKeyHelper
;
...
...
@@ -16,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
/**
* @author leafinsight
*/
@Api
(
value
=
"/api/v2/configurator"
,
tags
=
"选配器
(V2)
模块"
)
@Api
(
value
=
"/api/v2/configurator"
,
tags
=
"选配器模块"
)
@RestController
@RequestMapping
(
value
=
"/v2"
)
public
class
ConfiguratorV2Controller
{
...
...
@@ -41,5 +40,40 @@ public class ConfiguratorV2Controller {
businessKeyHelper
.
getDataSourceFlag
(
bomInitializeInputV2DTO
.
getBusinessKey
()));
}
@ApiOperation
(
value
=
"前置验证"
,
notes
=
"前置验证"
)
@PostMapping
(
value
=
"/preValidate"
)
@ResponseStatus
(
HttpStatus
.
OK
)
// @BizLog(action = "前置验证")
public
PreValidationOutputV2DTO
preValidate
(
@RequestBody
PreValidationInputV2DTO
preValidationInputV2DTO
)
{
return
configuratorV2Service
.
preValidate
(
preValidationInputV2DTO
,
businessKeyHelper
.
getTokenByBusinessKey
(
preValidationInputV2DTO
.
getBusinessKey
()),
businessKeyHelper
.
getDataSourceFlag
(
preValidationInputV2DTO
.
getBusinessKey
()));
}
/**
* @description 验证配置按钮
* @param postValidationInputV2DTO
* @return
*/
@ApiOperation
(
value
=
"后置验证"
,
notes
=
"后置验证"
)
@PostMapping
(
value
=
"/postValidate"
)
@ResponseStatus
(
HttpStatus
.
OK
)
// @BizLog(action = "后置验证")
public
PostValidateOutputV2DTO
postValidate
(
@RequestBody
PostValidationInputV2DTO
postValidationInputV2DTO
)
{
return
configuratorV2Service
.
postValidate
(
postValidationInputV2DTO
,
businessKeyHelper
.
getTokenByBusinessKey
(
postValidationInputV2DTO
.
getBusinessKey
()),
businessKeyHelper
.
getDataSourceFlag
(
postValidationInputV2DTO
.
getBusinessKey
()));
}
@ApiOperation
(
value
=
"生成配置"
,
notes
=
"生成配置"
)
@PostMapping
(
value
=
"/generateConfiguration"
)
@ResponseStatus
(
HttpStatus
.
OK
)
// @BizLog(action = "生成配置")
public
GenerateConfigurationOutputV2DTO
generateConfiguration
(
@RequestBody
PostValidationInputV2DTO
postValidationInputV2DTO
)
{
return
configuratorV2Service
.
generateConfiguration
(
postValidationInputV2DTO
,
businessKeyHelper
.
getTokenByBusinessKey
(
postValidationInputV2DTO
.
getBusinessKey
()),
businessKeyHelper
.
getDataSourceFlag
(
postValidationInputV2DTO
.
getBusinessKey
()));
}
}
src/main/java/cn/com/uitech/authorization/controller/StandardModelManageController.java
View file @
5ddf32e1
...
...
@@ -21,7 +21,6 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@RestController
@RequestMapping
(
"/standardModelManage"
)
@ApiIgnore
@Api
(
tags
=
{
"StandardModelManageDto 基准机型管理"
})
public
class
StandardModelManageController
{
...
...
@@ -33,6 +32,7 @@ public class StandardModelManageController {
* @param standardModelManageDto
* @return StandardModelManageDto
*/
@ApiIgnore
@PostMapping
(
"/getStandardModel"
)
@ApiOperation
(
value
=
"基准机型管理 查询"
,
notes
=
"基准机型管理 查询"
,
httpMethod
=
"POST"
)
public
CrmResponseEntity
<
StandardModelManageViewDto
>
getStandardModel
(
@RequestBody
StandardModelManageDto
standardModelManageDto
){
...
...
src/main/java/cn/com/uitech/authorization/pojo/SysUser.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
authorization
.
pojo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Transient
;
import
javax.persistence.*
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -21,22 +20,26 @@ import java.util.List;
*/
@Data
@Entity
(
name
=
"sys_user"
)
@ApiModel
(
value
=
"用户信息实体类"
)
public
class
SysUser
implements
UserDetails
{
/**
* 用户id
*/
@Id
@ApiModelProperty
(
hidden
=
true
)
private
String
id
;
/**
* 用户名
*/
@ApiModelProperty
(
name
=
"username"
,
value
=
"用户名"
,
dataType
=
"String"
)
@Column
(
nullable
=
false
,
unique
=
true
)
private
String
username
;
/**
* 密码
*/
@ApiModelProperty
(
name
=
"password"
,
value
=
"密码"
,
dataType
=
"String"
)
@Column
(
nullable
=
false
)
private
String
password
;
...
...
@@ -45,35 +48,43 @@ public class SysUser implements UserDetails {
/**
* 状态
*/
@ApiModelProperty
(
hidden
=
true
)
@Column
(
nullable
=
false
)
private
String
status
;
@Transient
@ApiModelProperty
(
hidden
=
true
)
private
String
computername
;
@Transient
@ApiModelProperty
(
hidden
=
true
)
private
String
userprofile
;
@Transient
@ApiModelProperty
(
hidden
=
true
)
private
String
ipAddr
;
/**
* 角色
*/
@Transient
@ApiModelProperty
(
hidden
=
true
)
private
List
<
GrantedAuthority
>
roles
;
@Override
@ApiModelProperty
(
hidden
=
true
)
public
Collection
<?
extends
GrantedAuthority
>
getAuthorities
()
{
return
roles
;
}
@Override
@ApiModelProperty
(
hidden
=
true
)
public
String
getUsername
()
{
return
username
;
}
@JsonIgnore
@ApiModelProperty
(
hidden
=
true
)
@Override
public
boolean
isAccountNonExpired
()
{
return
true
;
...
...
@@ -81,17 +92,20 @@ public class SysUser implements UserDetails {
@JsonIgnore
@Override
@ApiModelProperty
(
hidden
=
true
)
public
boolean
isAccountNonLocked
()
{
return
true
;
}
@JsonIgnore
@ApiModelProperty
(
hidden
=
true
)
@Override
public
boolean
isCredentialsNonExpired
()
{
return
true
;
}
@JsonIgnore
@ApiModelProperty
(
hidden
=
true
)
@Override
public
boolean
isEnabled
()
{
return
true
;
...
...
src/main/java/cn/com/uitech/config/dto/GenerateConfigurationOutputV2DTO.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
dto
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public
class
GenerateConfigurationOutputV2DTO
{
private
Boolean
result
;
private
String
message
;
private
Long
configId
;
// private Boolean npStatus;
// private Boolean syStatus;
// private Boolean thinkServiceStatus;
}
src/main/java/cn/com/uitech/config/dto/PostValidateOutputV2DTO.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
dto
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public
class
PostValidateOutputV2DTO
{
private
Boolean
result
;
private
String
message
;
}
src/main/java/cn/com/uitech/config/dto/PostValidationInputV2DTO.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* @author leafinsight
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
PostValidationInputV2DTO
{
/**
* BomCode :
* Division :
* VtStr :
* CVS :
*/
private
String
bomCode
;
private
String
division
;
private
String
userCode
;
private
List
<
TotalCharacteristicListBean
>
totalCharacteristicList
;
private
List
<
PreValidationInputV2DTO
.
SelectedCharacteristicBean
>
selectedCharacteristicList
;
private
boolean
selectedComplete
=
true
;
private
String
businessKey
;
private
List
<
AttributesBeanDTO
>
attributes
;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public
static
class
TotalCharacteristicListBean
{
/**
* characteristicCode : 29961
* value : ["2"]
*/
private
String
characteristicCode
;
private
List
<
String
>
values
;
}
}
src/main/java/cn/com/uitech/config/entity/BOMCVName.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
entity
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
java.util.List
;
@Getter
@Setter
@NoArgsConstructor
public
class
BOMCVName
{
/**
* bomCode : 10BWCTO1WW
* cList : [{"r3Code":"0000029961","r3EName":"Processor","name":"CPU","vList":[{"code":"00000299610010","r3EName":"CORE I7 4770S_8M CACHE","name":"Core i7-4770S 3.1GHz 8M Cache"}]},{"r3Code":"0000029961","r3EName":"Processor","name":"CPU","vList":[{"code":"00000299610010","r3EName":"CORE I7 4770S_8M CACHE","name":"Core i7-4770S 3.1GHz 8M Cache"}]}]
*/
private
String
bomCode
;
private
List
<
CListBean
>
cList
;
@Getter
@Setter
@NoArgsConstructor
public
static
class
CListBean
{
/**
* r3Code : 0000029961
* r3EName : Processor
* name : CPU
* vList : [{"code":"00000299610010","r3EName":"CORE I7 4770S_8M CACHE","name":"Core i7-4770S 3.1GHz 8M Cache"}]
*/
private
String
r3Code
;
private
String
r3EName
;
private
String
name
;
private
List
<
VListBean
>
vList
;
@Getter
@Setter
@NoArgsConstructor
public
static
class
VListBean
{
/**
* code : 00000299610010
* r3EName : CORE I7 4770S_8M CACHE
* name : Core i7-4770S 3.1GHz 8M Cache
*/
private
String
code
;
private
String
r3EName
;
private
String
name
;
}
}
}
src/main/java/cn/com/uitech/config/entity/MessageJson.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
entity
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
@Getter
@Setter
@NoArgsConstructor
public
class
MessageJson
{
/**
* Flag :
* Message :
*/
private
boolean
flag
;
private
String
message
;
}
src/main/java/cn/com/uitech/config/entity/ODRelation.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.*
;
import
java.util.Date
;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table
(
name
=
"ODRelation"
)
public
class
ODRelation
{
@Id
@Column
(
name
=
"ODRelationID"
)
private
Integer
odRelationId
;
@Column
(
name
=
"Name"
)
private
String
name
;
@Column
(
name
=
"Type"
,
columnDefinition
=
"tinyint"
)
private
Integer
type
;
@Column
(
name
=
"Description"
)
private
String
description
;
@Column
(
name
=
"BOMCode"
)
private
String
bomCode
;
@Column
(
name
=
"BOMName"
)
private
String
bomName
;
@Column
(
name
=
"ProductGroupCode"
,
columnDefinition
=
"char"
)
private
String
productGroupCode
;
@Column
(
name
=
"FirstCharacteristicCode"
)
private
String
firstCharacteristicCode
;
@Column
(
name
=
"FirstR3Code"
)
private
String
firstR3Code
;
@Column
(
name
=
"SecondCharacteristicCode"
)
private
String
secondCharacteristicCode
;
@Column
(
name
=
"SecondR3Code"
)
private
String
secondR3Code
;
@Column
(
name
=
"RelatedCharacteristicCode"
)
private
String
relatedCharacteristicCode
;
@Column
(
name
=
"RelatedR3Code"
)
private
String
relatedR3Code
;
@Column
(
name
=
"FirstCharacteristicCodeName"
)
private
String
firstCharacteristicCodeName
;
@Column
(
name
=
"SecondCharacteristicCodeName"
)
private
String
secondCharacteristicCodeName
;
@Column
(
name
=
"RelatedCharacteristicCodeName"
)
private
String
relatedCharacteristicCodeName
;
@Column
(
name
=
"FirstCharacteristicValue"
)
private
String
firstCharacteristicValue
;
@Column
(
name
=
"FirstR3VCode"
)
private
String
firstR3VCode
;
@Column
(
name
=
"SecondCharacteristicValue"
)
private
String
secondCharacteristicValue
;
@Column
(
name
=
"SecondR3VCode"
)
private
String
secondR3VCode
;
@Column
(
name
=
"RelatedCharacteristicValue"
)
private
String
relatedCharacteristicValue
;
@Column
(
name
=
"RelatedR3VCode"
)
private
String
relatedR3VCode
;
@Column
(
name
=
"FirstCharacteristicValueName"
)
private
String
firstCharacteristicValueName
;
@Column
(
name
=
"SecondCharacteristicValueName"
)
private
String
secondCharacteristicValueName
;
@Column
(
name
=
"RelatedCharacteristicValueName"
)
private
String
relatedCharacteristicValueName
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"CreateTime"
)
private
Date
createdTime
;
}
src/main/java/cn/com/uitech/config/entity/ODRelationModel.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
entity
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
@Getter
@Setter
@NoArgsConstructor
public
class
ODRelationModel
{
/**
* ODRelationID : 0
* Name :
* Type : 0
* Description :
* BOMCode :
* BOMName :
* ProductGroupCode :
* FirstCharacteristicCode :
* FirstR3Code :
* SecondCharacteristicCode :
* SecondR3Code :
* RelatedCharacteristicCode :
* RelatedR3Code :
* FirstCharacteristicCodeName :
* SecondCharacteristicCodeName :
* RelatedCharacteristicCodeName :
* FirstCharacteristicValue :
* FirstR3VCode :
* SecondCharacteristicValue :
* SecondR3VCode :
* RelatedCharacteristicValue :
* RelatedR3VCode :
* FirstCharacteristicValueName :
* SecondCharacteristicValueName :
* RelatedCharacteristicValueName :
* CreateTime :
*/
private
int
odRelationId
;
private
String
name
;
private
int
type
;
private
String
description
;
private
String
bomCode
;
private
String
bomName
;
private
String
productGroupCode
;
private
String
firstCharacteristicCode
;
private
String
firstR3Code
;
private
String
secondCharacteristicCode
;
private
String
secondR3Code
;
private
String
relatedCharacteristicCode
;
private
String
relatedR3Code
;
private
String
firstCharacteristicCodeName
;
private
String
secondCharacteristicCodeName
;
private
String
relatedCharacteristicCodeName
;
private
String
firstCharacteristicValue
;
private
String
firstR3VCode
;
private
String
secondCharacteristicValue
;
private
String
secondR3VCode
;
private
String
relatedCharacteristicValue
;
private
String
relatedR3VCode
;
private
String
firstCharacteristicValueName
;
private
String
secondCharacteristicValueName
;
private
String
relatedCharacteristicValueName
;
private
String
createTime
;
}
src/main/java/cn/com/uitech/config/repository/ODRelationRepository.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
repository
;
import
cn.com.uitech.config.entity.ODRelation
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
ODRelationRepository
extends
JpaRepository
<
ODRelation
,
Integer
>
{
List
<
ODRelation
>
findByProductGroupCodeAndBomCode
(
String
productGroupCode
,
String
bomCode
);
}
src/main/java/cn/com/uitech/config/service/ConfiguratorCacheService.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
service
;
import
cn.com.uitech.config.entity.CTOQTYCMapping
;
import
cn.com.uitech.config.entity.CTOTotalQTYMapping
;
import
cn.com.uitech.config.entity.ODData
;
import
cn.com.uitech.config.entity.SpecialR3Code
;
import
cn.com.uitech.config.entity.*
;
import
cn.com.uitech.config.vo.BOMCVCacheVO
;
import
java.util.List
;
...
...
@@ -50,5 +47,7 @@ public interface ConfiguratorCacheService {
*/
List
<
String
>
getFollowR3Code
(
String
token
,
String
bomCode
,
String
dataSourceFlag
);
BOMCVName
getBOMCVName
(
String
token
,
String
bomCode
,
String
division
,
String
dataSourceFlag
);
}
src/main/java/cn/com/uitech/config/service/ConfiguratorV2Service.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
service
;
import
cn.com.uitech.config.dto.BomInitializeInputV2DTO
;
import
cn.com.uitech.config.dto.BomInitializeOutputV2DTO
;
import
cn.com.uitech.config.dto.*
;
public
interface
ConfiguratorV2Service
{
BomInitializeOutputV2DTO
getBasicDataWithName
(
BomInitializeInputV2DTO
bomInitializeInputV2DTO
,
String
token
,
String
dataSourceFlag
)
throws
Exception
;
PostValidateOutputV2DTO
postValidate
(
PostValidationInputV2DTO
postValidationInputV2DTO
,
String
token
,
String
dataSourceFlag
);
GenerateConfigurationOutputV2DTO
generateConfiguration
(
PostValidationInputV2DTO
postValidationInputV2DTO
,
String
token
,
String
dataSourceFlag
)
;
/**
* @param preValidationInputV2DTO 前置验证输入参数
* @param token 保留
* @return PreValidationOutputV2DTO
*/
PreValidationOutputV2DTO
preValidate
(
PreValidationInputV2DTO
preValidationInputV2DTO
,
String
token
,
String
dataSourceFlag
)
;
}
src/main/java/cn/com/uitech/config/service/ODDataService.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
service
;
import
cn.com.uitech.config.entity.CTOQTYCMapping
;
import
cn.com.uitech.config.entity.CTOTotalQTYMapping
;
import
cn.com.uitech.config.entity.SpecialR3Code
;
import
cn.com.uitech.config.entity.*
;
import
java.util.List
;
...
...
@@ -35,4 +33,14 @@ public interface ODDataService {
*/
List
<
String
>
getFollowR3Code
(
String
bomCode
,
String
dataSourceFlag
);
/// <summary>
/// 获取BOM特征
/// </summary>
/// <param name="bomCode"></param>
/// <returns></returns>
List
<
BOMCVNameVM
>
getBOMCVNameVMByCode
(
String
bomCode
,
String
division
,
String
dataSourceFlag
);
List
<
ODRelationModel
>
getODRelationList
(
String
productGroupCode
,
String
bomCode
,
String
dataSourceFlag
);
}
src/main/java/cn/com/uitech/config/service/OdService.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
service
;
import
cn.com.uitech.config.entity.MessageJson
;
import
cn.com.uitech.config.entity.ODData
;
import
cn.com.uitech.config.vo.BOMInitializeExResultVO
;
import
cn.com.uitech.config.vo.ConfigProcResultVO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -71,6 +73,10 @@ public interface OdService {
/// <returns></returns>
Boolean
checkAllSelected
(
Map
<
String
,
Integer
>
arySelected
,
List
<
String
>
aryChar
,
List
<
String
>
aryHiddenC
)
;
//检查常规特配配置结果的OD关系(公共方法)
MessageJson
checkLMSODRelation
(
String
bomcode
,
String
productgroupcode
,
String
vcodes
,
ArrayList
vcodeList
,
String
dataSourceFlag
);
}
src/main/java/cn/com/uitech/config/service/impl/ConfiguratorCacheServiceImpl.java
View file @
5ddf32e1
...
...
@@ -388,6 +388,62 @@ public class ConfiguratorCacheServiceImpl implements ConfiguratorCacheService {
return
aryList
;
}
@Override
public
BOMCVName
getBOMCVName
(
String
token
,
String
bomCode
,
String
division
,
String
dataSourceFlag
)
{
BOMCVName
bomcvName
=
new
BOMCVName
();
try
{
ValueOperations
<
String
,
String
>
operations
=
redisTemplate
.
opsForValue
();
String
str
=
operations
.
get
(
BOM_CV_NAME
+
"_"
+
bomCode
+
"_"
+
division
+
"@"
+
token
);
if
(
StringUtil
.
isNullOrEmpty
(
str
))
{
bomcvName
=
setBOMCVName
(
token
,
bomCode
,
division
,
dataSourceFlag
);
}
else
{
bomcvName
=
JSON
.
parseObject
(
str
,
new
TypeReference
<
BOMCVName
>()
{
});
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
bomcvName
;
}
public
BOMCVName
setBOMCVName
(
String
token
,
String
bomCode
,
String
division
,
String
dataSourceFlag
)
{
List
<
BOMCVNameVM
>
bomcvNameVMList
=
odDataService
.
getBOMCVNameVMByCode
(
bomCode
,
division
,
dataSourceFlag
);
BOMCVName
bomcvName
=
new
BOMCVName
();
if
(
bomcvNameVMList
.
size
()
>
0
)
{
try
{
ValueOperations
<
String
,
String
>
operations
=
redisTemplate
.
opsForValue
();
List
<
BOMCVNameVM
>
pList
=
bomcvNameVMList
.
stream
().
filter
(
d
->
d
.
getR3Code
().
trim
().
length
()
==
10
).
collect
(
Collectors
.
toList
());
bomcvName
.
setBomCode
(
bomCode
);
List
<
BOMCVName
.
CListBean
>
cListBeanList
=
new
ArrayList
<>();
for
(
BOMCVNameVM
item
:
pList
)
{
BOMCVName
.
CListBean
cListBean
=
new
BOMCVName
.
CListBean
();
cListBean
.
setR3Code
(
item
.
getR3Code
());
cListBean
.
setR3EName
(
item
.
getR3EName
());
cListBean
.
setName
(
item
.
getName
());
List
<
BOMCVName
.
CListBean
.
VListBean
>
vListBeanList
=
new
ArrayList
<>();
List
<
BOMCVNameVM
>
childList
=
bomcvNameVMList
.
stream
().
filter
(
d
->
d
.
getCharacteristicCode
().
equals
(
item
.
getCharacteristicCode
())).
collect
(
Collectors
.
toList
());
for
(
BOMCVNameVM
cItem
:
childList
)
{
BOMCVName
.
CListBean
.
VListBean
vListBean
=
new
BOMCVName
.
CListBean
.
VListBean
();
vListBean
.
setCode
(
cItem
.
getR3Code
().
trim
());
vListBean
.
setR3EName
(
cItem
.
getR3EName
().
trim
());
vListBean
.
setName
(
cItem
.
getName
().
trim
());
vListBeanList
.
add
(
vListBean
);
}
cListBean
.
setVList
(
vListBeanList
);
cListBeanList
.
add
(
cListBean
);
bomcvName
.
setCList
(
cListBeanList
);
}
operations
.
set
(
BOM_CV_NAME
+
"_"
+
bomCode
+
"_"
+
division
+
"@"
+
token
,
JSON
.
toJSONString
(
bomcvName
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
bomcvName
;
}
}
...
...
src/main/java/cn/com/uitech/config/service/impl/ConfiguratorV2ServiceImpl.java
View file @
5ddf32e1
...
...
@@ -21,8 +21,10 @@ import cn.com.uitech.config.vo.BOMCVCacheVO;
import
cn.com.uitech.config.vo.BOMInitializeExResultVO
;
import
cn.com.uitech.config.vo.ConfigProcResultVO
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
...
...
@@ -30,6 +32,7 @@ import org.springframework.stereotype.Service;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
public
class
ConfiguratorV2ServiceImpl
implements
ConfiguratorV2Service
{
...
...
@@ -77,7 +80,7 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
String
bomCode
=
bomInitializeInputV2DTO
.
getBomCode
();
String
division
=
bomInitializeInputV2DTO
.
getDivision
();
//判断是否有configid 已经生成配置了
if
(!
StringUtil
.
isNullOrEmpty
(
bomInitializeInputV2DTO
.
getConfigId
()))
{
ModelBasicInfo
modelBasicInfo
=
new
ModelBasicInfo
();
...
...
@@ -327,6 +330,7 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
* @param token 保留
* @return PreValidationOutputV2DTO
*/
@Override
public
PreValidationOutputV2DTO
preValidate
(
PreValidationInputV2DTO
preValidationInputV2DTO
,
String
token
,
String
dataSourceFlag
)
{
if
(
token
==
null
)
{
return
null
;
...
...
@@ -336,6 +340,7 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
List
<
String
>
selectedList
=
new
ArrayList
<>();
//模拟用default值构造选中项
//将前台传递的c和v 拼接到一起放到集合里面
for
(
PreValidationInputV2DTO
.
SelectedCharacteristicBean
selectedCharacteristicListBean
:
preValidationInputV2DTO
.
getSelectedCharacteristicList
()
)
{
selectedList
.
add
(
selectedCharacteristicListBean
.
getCharacteristicCode
()
+
":"
+
selectedCharacteristicListBean
.
getCharacteristicValueCode
());
...
...
@@ -343,15 +348,18 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
AttributesBeanVO
attributesBeanVO
=
AttributesBeanUtil
.
builderAttributesBeanVO
(
preValidationInputV2DTO
.
getAttributes
(),
preValidationInputV2DTO
.
getRole
());
preValidationOutputV2DTO
=
frontValidateVariantTable
(
preValidationInputV2DTO
.
getBomCode
(),
preValidationOutputV2DTO
=
frontValidateVariantTable
(
preValidationInputV2DTO
.
getBomCode
(),
preValidationInputV2DTO
.
getDivision
(),
StringUtil
.
padLeft
(
preValidationInputV2DTO
.
getCharacteristicCode
(),
10
,
'0'
),
StringUtil
.
padLeft
(
preValidationInputV2DTO
.
getCharacteristicCode
(),
10
,
'0'
)
+
StringUtil
.
padLeft
(
preValidationInputV2DTO
.
getCharacteristicValueCode
(),
4
,
'0'
),
StringUtil
.
padLeft
(
preValidationInputV2DTO
.
getCharacteristicValueCode
(),
4
,
'0'
),
preValidationInputV2DTO
.
getWithDeriveCharacteristic
(),
String
.
join
(
","
,
selectedList
),
token
,
attributesBeanVO
.
getRoleVisibleType
(),
dataSourceFlag
);
attributesBeanVO
.
getRoleVisibleType
(),
dataSourceFlag
);
preValidationOutputV2DTO
.
setResult
(
true
);
...
...
@@ -715,9 +723,15 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
boolean
clearSel
=
false
;
boolean
hasNumC
=
false
;
log
.
info
(
"frontValidateVariantTable方法的参数1111是:bomCode:{}---division:{}---r3Code:{}"
+
"---r3VCode:{}---strWithDerive:{}---cvSelected:{}---token:{}---roleVisibleType:{}---dataSourceFlag:{}"
,
bomCode
,
division
,
r3Code
,
r3VCode
,
strWithDerive
,
cvSelected
,
token
,
roleVisibleType
,
dataSourceFlag
);
//TODO
boolean
withDerive
=
(
StringUtil
.
isNullOrEmpty
(
strWithDerive
))
||
(
Boolean
.
parseBoolean
(
strWithDerive
));
log
.
info
(
"withDerive22222变量的值是:{}"
,
withDerive
);
//TODO Cache
//TODO 数量C
...
...
@@ -735,12 +749,22 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
List
<
CTOTotalQTYMapping
>
ctoTotalQTYMappingList
=
configuratorCacheService
.
getCTOTotalQTYMapping
(
dataSourceFlag
);
List
<
String
>
aryQtyChar
=
new
ArrayList
<>();
log
.
info
(
"CTOQTYCMapping33333表数据是:{}"
,
JSONObject
.
toJSONString
(
ctoQtyCharacteristicMappingList
));
System
.
out
.
println
(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>."
);
log
.
info
(
"ctoTotalQTYMappingList33333表数据是:{}"
,
JSONObject
.
toJSONString
(
ctoTotalQTYMappingList
.
subList
(
0
,
10
)));
Map
<
String
,
String
>
aryQTYCMappingList
=
new
HashMap
<>(
ctoQtyCharacteristicMappingList
.
size
());
for
(
CTOQTYCMapping
mapping
:
ctoQtyCharacteristicMappingList
)
{
aryQtyChar
.
add
(
StringUtil
.
trimLeadingCharacter
(
mapping
.
getQtyR3Code
(),
'0'
));
aryQTYCMappingList
.
put
(
StringUtil
.
trimLeadingCharacter
(
mapping
.
getQtyR3Code
(),
'0'
),
StringUtil
.
trimLeadingCharacter
(
mapping
.
getR3Code
(),
'0'
));
}
log
.
info
(
"aryQtyChar444444集合的数据是:{}"
,
JSONObject
.
toJSONString
(
aryQtyChar
));
System
.
out
.
println
(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>."
);
log
.
info
(
"aryQTYCMappingList4444444集合的数据是:{}"
,
JSONObject
.
toJSONString
(
aryQTYCMappingList
));
//Dictionary<String, int> CurrentSelectedStart = new Dictionary<String, int>(ChoosingModelCache.CurrentSelected);
//String[] vvArray = ChoosingModelCache.NumsVVArray;
...
...
@@ -761,14 +785,24 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
List
<
BasicDataProperty
>
aryC
=
bomcvCacheVO
.
getAryC
();
List
<
BasicDataPropertyValue
>
aryValue
=
bomcvCacheVO
.
getAryValue
();
log
.
info
(
"aryBOM5555555集合的数据是:{}"
,
JSONObject
.
toJSONString
(
aryBOM
));
System
.
out
.
println
(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>."
);
log
.
info
(
"aryC5555555554集合的数据是:{}"
,
JSONObject
.
toJSONString
(
aryC
));
log
.
info
(
"aryValue5555555554集合的数据是:{}"
,
JSONObject
.
toJSONString
(
aryValue
));
//key:c编号value:v编号int类型 (都去除0了 ,v编号去除c的拼接编号了)
Map
<
String
,
List
<
Integer
>>
aryCVSInt
=
new
HashMap
<>(
aryC
.
size
());
if
(
aryBOM
.
size
()
>
0
&&
aryBOM
.
get
(
0
).
getBomNewType
().
equals
(
BOMNewType
.
NewType
.
BOMNewType
()))
{
hasNumC
=
aryBOM
.
get
(
0
).
getHasNumC
()
!=
0
;
for
(
BasicDataProperty
property
:
aryC
)
{
//当前c的所有v之的编号集合 string类型
List
<
String
>
vs
=
new
ArrayList
<>();
//当前c的所有v之的编号集合 int类型
List
<
Integer
>
vsi
=
new
ArrayList
<>();
//当前ccode
String
r3code
=
property
.
getR3Code
();
for
(
BasicDataPropertyValue
propertyValue
:
aryValue
)
{
...
...
@@ -801,6 +835,7 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
}
}
//去除数量c
if
(
hasNumC
)
{
List
<
String
>
aryHiddenTemp
=
getUnDisplayNumC
(
ctoTotalQTYMappingList
,
ctoQtyCharacteristicMappingList
);
aryHiddenC
.
removeAll
(
aryHiddenTemp
);
...
...
@@ -811,14 +846,21 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
//TODO Cache需要考虑只参与一个variantTable的从属C集合表
List
<
String
>
aryFollowC
=
configuratorCacheService
.
getFollowR3Code
(
token
,
bomCode
,
dataSourceFlag
);
//此方法保留aryFollowC集合中存在aryHiddenC這个集合的元素(类似于求交集)
aryFollowC
.
retainAll
(
aryHiddenC
);
//aryCVSInt key:c编号value:v编号int类型 (都去除0了 ,v编号去除c的拼接编号了)
Map
<
String
,
List
<
Integer
>>
aryCVSClone
=
new
HashMap
<>(
aryCVSInt
);
log
.
info
(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
);
log
.
info
(
"aryCVSClone666666666666666666666666map的key是:{}"
,
aryCVSClone
.
toString
());
Map
<
String
,
List
<
Integer
>>
relationship
;
//TODO 暂时用传入的已选特征值
//TODO 暂时用传入的已选特征值
(参数是分割字符串返回map对象)
Map
<
String
,
Integer
>
arySelectedCVSClone
=
new
HashMap
<
String
,
Integer
>(
odService
.
getSelectedCV
(
cvSelected
));
log
.
info
(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
);
log
.
info
(
"cvSelected777777777777777777777的数据是:{}"
,
JSONObject
.
toJSONString
(
cvSelected
));
log
.
info
(
"arySelectedCVSClone777777777777777777777的数据是:{}"
,
JSONObject
.
toJSONString
(
arySelectedCVSClone
));
@SuppressWarnings
(
"MismatchedQueryAndUpdateOfCollection"
)
List
<
String
>
cvArray
=
new
ArrayList
<>();
...
...
@@ -1128,6 +1170,9 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
activeValuesBeanList
.
add
(
activeValuesBean
);
}
log
.
info
(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
);
log
.
info
(
"activeValuesBeanList1515151515:{}"
,
JSONObject
.
toJSONString
(
activeValuesBeanList
));
preValidationOutputV2DTO
.
setMessage
(
""
);
preValidationOutputV2DTO
.
setResult
(
true
);
preValidationOutputV2DTO
.
setActiveValues
(
activeValuesBeanList
);
...
...
@@ -1725,7 +1770,6 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
return
dicResult
;
}
/**
* @param aryValues 所有值Name的集合
* @param aryUsableV 可用值的集合
...
...
@@ -1785,7 +1829,6 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
return
aryUpgradeNonNum
;
}
/**
* @param arySelectedCVSClone 选择的CV
* @param aryTotalChar 全部的特征
...
...
@@ -1812,8 +1855,183 @@ public class ConfiguratorV2ServiceImpl implements ConfiguratorV2Service {
}
//////////////////////////////////////////////getData接口完 下面是后置验证 postValidate/////////////////////////////////////////////////////
@Override
public
PostValidateOutputV2DTO
postValidate
(
PostValidationInputV2DTO
postValidationInputV2DTO
,
String
token
,
String
dataSourceFlag
)
{
if
(
token
==
null
)
{
return
null
;
}
Map
<
String
,
String
>
arySelected
=
new
HashMap
<>(
postValidationInputV2DTO
.
getSelectedCharacteristicList
().
size
());
for
(
PreValidationInputV2DTO
.
SelectedCharacteristicBean
selectedCharacteristicListBean
:
postValidationInputV2DTO
.
getSelectedCharacteristicList
()
)
{
arySelected
.
put
(
selectedCharacteristicListBean
.
getCharacteristicCode
(),
selectedCharacteristicListBean
.
getCharacteristicValueCode
());
}
//后置页面VT
List
<
String
>
resultList
=
validateVariantTableEx
(
postValidationInputV2DTO
.
getBomCode
(),
postValidationInputV2DTO
.
getDivision
(),
arySelected
,
token
,
dataSourceFlag
);
PostValidateOutputV2DTO
postValidateOutputV2DTO
=
new
PostValidateOutputV2DTO
();
if
(
resultList
!=
null
&&
resultList
.
size
()
>
0
)
{
postValidateOutputV2DTO
.
setResult
(
false
);
BOMCVName
bomcvName
=
configuratorCacheService
.
getBOMCVName
(
token
,
postValidationInputV2DTO
.
getBomCode
(),
postValidationInputV2DTO
.
getDivision
(),
dataSourceFlag
);
postValidateOutputV2DTO
.
setMessage
(
bomcvName
.
getCList
().
stream
().
filter
(
b
->
resultList
.
contains
(
StringUtil
.
trimLeadingCharacter
(
b
.
getR3Code
().
trim
(),
'0'
))).
map
(
BOMCVName
.
CListBean
::
getName
).
collect
(
Collectors
.
joining
(
","
)));
}
else
{
StringBuilder
resultData
=
new
StringBuilder
();
//LMS自定义OD验证
MessageJson
restultstr
=
checkLMSODRelation
(
postValidationInputV2DTO
.
getBomCode
(),
postValidationInputV2DTO
.
getDivision
(),
null
,
postValidationInputV2DTO
.
getSelectedCharacteristicList
(),
dataSourceFlag
);
if
(
restultstr
==
null
||
restultstr
.
isFlag
())
{
postValidateOutputV2DTO
.
setResult
(
true
);
postValidateOutputV2DTO
.
setMessage
(
""
);
}
else
{
resultData
.
append
(
"当前机型存配置不符合规则(LMS-OD),信息如下:"
);
resultData
.
append
(
restultstr
.
getMessage
());
postValidateOutputV2DTO
.
setResult
(
false
);
postValidateOutputV2DTO
.
setMessage
(
resultData
.
toString
());
}
}
return
postValidateOutputV2DTO
;
}
/**
* 后置页面VT
*
* @param bomCode 物料编号
* @param division 产品组
* @param cvDic 特征值对集合
* @param token 保留
* @return 略
*/
private
List
<
String
>
validateVariantTableEx
(
String
bomCode
,
String
division
,
Map
<
String
,
String
>
cvDic
,
String
token
,
String
dataSourceFlag
)
{
List
<
String
>
resultList
=
new
ArrayList
<>();
Map
<
Integer
,
ODData
>
odDataList
=
configuratorCacheService
.
getVariantTable
(
token
,
bomCode
,
division
,
dataSourceFlag
);
if
(
odDataList
!=
null
&&
odDataList
.
size
()
>
0
)
{
String
valueCode
;
for
(
Map
.
Entry
<
Integer
,
ODData
>
odDataEntry
:
odDataList
.
entrySet
()
)
{
boolean
find
=
true
;
for
(
Map
.
Entry
<
Integer
,
Map
<
String
,
List
<
String
>>>
valuesEntry
:
odDataEntry
.
getValue
().
getAryData
().
entrySet
()
)
{
find
=
true
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
cValues
:
valuesEntry
.
getValue
().
entrySet
()
)
{
valueCode
=
cvDic
.
get
(
cValues
.
getKey
());
if
(!
cValues
.
getValue
().
contains
(
valueCode
))
{
find
=
false
;
}
}
if
(
find
)
{
break
;
}
}
if
(!
find
)
{
for
(
String
c
:
odDataEntry
.
getValue
().
getAryChar
())
{
if
(!
resultList
.
contains
(
c
))
{
resultList
.
add
(
c
);
}
}
}
}
}
return
resultList
;
}
private
MessageJson
checkLMSODRelation
(
String
bomcode
,
String
division
,
String
vcodes
,
List
<
PreValidationInputV2DTO
.
SelectedCharacteristicBean
>
selectedCharacteristicList
,
String
dataSourceFlag
)
{
ArrayList
vcodeList
=
new
ArrayList
();
selectedCharacteristicList
.
forEach
(
selectedCharacteristicBean
->
{
vcodeList
.
add
(
StringUtil
.
padLeft
(
selectedCharacteristicBean
.
getCharacteristicCode
(),
10
,
'0'
).
concat
(
StringUtil
.
padLeft
(
selectedCharacteristicBean
.
getCharacteristicValueCode
(),
4
,
'0'
)));
});
return
odService
.
checkLMSODRelation
(
bomcode
,
division
,
null
,
vcodeList
,
dataSourceFlag
);
}
/////////////////////////////////////////////后置验证完毕,生成配置单按钮/////////////////////////////
@Override
public
GenerateConfigurationOutputV2DTO
generateConfiguration
(
PostValidationInputV2DTO
postValidationInputV2DTO
,
String
token
,
String
dataSourceFlag
)
{
GenerateConfigurationOutputV2DTO
generateConfigurationOutputV2DTO
=
new
GenerateConfigurationOutputV2DTO
();
PostValidateOutputV2DTO
postValidateOutputV2DTO
=
null
;
if
(
postValidationInputV2DTO
.
isSelectedComplete
())
{
postValidateOutputV2DTO
=
postValidate
(
postValidationInputV2DTO
,
token
,
dataSourceFlag
);
}
ModelBasicInfo
modelBasicInfo
=
buildModel
(
postValidationInputV2DTO
);
if
(
dataSourceFlag
.
equals
(
lmsDataSource
))
{
configuratorRepository
.
insertModelBasicInfo
(
modelBasicInfo
);
}
modelBasicInfo
.
getModelConfigurations
().
forEach
(
a
->
a
.
setConfigId
(
modelBasicInfo
.
getId
()));
if
(
dataSourceFlag
.
equals
(
lmsDataSource
))
{
configuratorRepository
.
insertModelConfiguration
(
modelBasicInfo
.
getModelConfigurations
());
}
if
(!
postValidationInputV2DTO
.
isSelectedComplete
()
||
(
postValidateOutputV2DTO
!=
null
&&
postValidateOutputV2DTO
.
getResult
()))
{
generateConfigurationOutputV2DTO
.
setResult
(
true
);
generateConfigurationOutputV2DTO
.
setConfigId
(
modelBasicInfo
.
getId
());
}
else
{
generateConfigurationOutputV2DTO
.
setResult
(
false
);
generateConfigurationOutputV2DTO
.
setConfigId
(
modelBasicInfo
.
getId
());
if
(
postValidationInputV2DTO
.
isSelectedComplete
()
&&
postValidateOutputV2DTO
!=
null
)
{
generateConfigurationOutputV2DTO
.
setMessage
(
postValidateOutputV2DTO
.
getMessage
());
}
}
return
generateConfigurationOutputV2DTO
;
}
private
ModelBasicInfo
buildModel
(
PostValidationInputV2DTO
postValidationInputV2DTO
)
{
ModelBasicInfo
modelBasicInfo
=
new
ModelBasicInfo
();
modelBasicInfo
.
setDivision
(
postValidationInputV2DTO
.
getDivision
());
modelBasicInfo
.
setBomCode
(
postValidationInputV2DTO
.
getBomCode
());
modelBasicInfo
.
setUserCode
(
postValidationInputV2DTO
.
getUserCode
());
modelBasicInfo
.
setCreateTime
(
new
Date
());
List
<
ModelConfiguration
>
modelConfigurations
=
new
ArrayList
<>();
for
(
PreValidationInputV2DTO
.
SelectedCharacteristicBean
selectedCharacteristicBean
:
postValidationInputV2DTO
.
getSelectedCharacteristicList
()
)
{
ModelConfiguration
modelConfiguration
=
new
ModelConfiguration
();
modelConfiguration
.
setConfigId
(
1L
);
modelConfiguration
.
setCharacteristicValueCode
(
selectedCharacteristicBean
.
getCharacteristicValueCode
());
modelConfiguration
.
setCharacteristicCode
(
selectedCharacteristicBean
.
getCharacteristicCode
());
modelConfigurations
.
add
(
modelConfiguration
);
}
modelBasicInfo
.
setModelConfigurations
(
modelConfigurations
);
return
modelBasicInfo
;
}
}
src/main/java/cn/com/uitech/config/service/impl/ODDataServiceImpl.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
service
.
impl
;
import
cn.com.uitech.config.entity.CTOQTYCMapping
;
import
cn.com.uitech.config.entity.CTOTotalQTYMapping
;
import
cn.com.uitech.config.entity.SpecialR3Code
;
import
cn.com.uitech.config.entity.*
;
import
cn.com.uitech.config.repository.CharacteristicRepository
;
import
cn.com.uitech.config.repository.ConfiguratorRepository
;
import
cn.com.uitech.config.repository.ODRelationRepository
;
import
cn.com.uitech.config.service.ODDataService
;
import
com.google.common.collect.Maps
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
@Service
public
class
ODDataServiceImpl
implements
ODDataService
{
...
...
@@ -23,6 +26,9 @@ public class ODDataServiceImpl implements ODDataService {
@Autowired
private
CharacteristicRepository
characteristicRepository
;
@Autowired
private
ODRelationRepository
odRelationRepository
;
@Override
public
List
<
List
<?>>
getCharacteristicItemsByBomCodeV2ForPostGreSql
(
String
bomCode
,
String
division
,
int
cdbID
,
String
type
,
String
dataType
,
int
visibleType
,
String
dataSourceFlag
)
{
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
...
...
@@ -93,4 +99,37 @@ public class ODDataServiceImpl implements ODDataService {
//return characteristicRepository.getFollowR3Code(bomCode);
return
characteristicRepository
.
getFollowR3CodeForPostGreSql
(
bomCode
);
}
/// <summary>
/// 获取BOM特征
/// </summary>
/// <param name="bomCode"></param>
/// <returns></returns>
@Override
public
List
<
BOMCVNameVM
>
getBOMCVNameVMByCode
(
String
bomCode
,
String
division
,
String
dataSourceFlag
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"p1"
,
bomCode
);
map
.
put
(
"p2"
,
division
);
return
configuratorRepository
.
getBOMCVNameVMByCode
(
map
);
}
@Override
public
List
<
ODRelationModel
>
getODRelationList
(
String
productGroupCode
,
String
bomCode
,
String
dataSourceFlag
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
return
odRelationRepository
.
findByProductGroupCodeAndBomCode
(
productGroupCode
,
bomCode
)
.
stream
()
.
map
(
odRelation
->
{
ODRelationModel
odRelationModel
=
new
ODRelationModel
();
BeanUtils
.
copyProperties
(
odRelation
,
odRelationModel
,
"createdTime"
);
Optional
.
ofNullable
(
odRelation
.
getCreatedTime
())
.
ifPresent
(
createdTime
->
odRelationModel
.
setCreateTime
(
sdf
.
format
(
createdTime
)));
return
odRelationModel
;
}).
collect
(
Collectors
.
toList
());
}
}
src/main/java/cn/com/uitech/config/service/impl/OdServiceImpl.java
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
service
.
impl
;
import
cn.com.uitech.config.entity.MessageJson
;
import
cn.com.uitech.config.entity.ODData
;
import
cn.com.uitech.config.entity.ODRelationModel
;
import
cn.com.uitech.config.service.ConfiguratorCacheService
;
import
cn.com.uitech.config.service.ODDataService
;
import
cn.com.uitech.config.service.OdService
;
import
cn.com.uitech.config.utils.CastUtil
;
import
cn.com.uitech.config.utils.StringUtil
;
import
cn.com.uitech.config.vo.BOMInitializeExResultVO
;
import
cn.com.uitech.config.vo.CheckODRelationOV
;
import
cn.com.uitech.config.vo.ConfigProcResultVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -18,6 +22,9 @@ public class OdServiceImpl implements OdService {
@Autowired
private
ConfiguratorCacheService
configuratorCacheService
;
@Autowired
private
ODDataService
odDataService
;
/// <summary>
/// BOM加载VT过滤
/// </summary>
...
...
@@ -443,4 +450,100 @@ public class OdServiceImpl implements OdService {
return
ret
;
}
//检查常规特配配置结果的OD关系(公共方法)
@Override
public
MessageJson
checkLMSODRelation
(
String
bomcode
,
String
productgroupcode
,
String
vcodes
,
ArrayList
vcodeList
,
String
dataSourceFlag
)
{
if
(
vcodeList
==
null
)
{
String
[]
vcodesArr
=
vcodes
.
split
(
";"
);
vcodeList
=
new
ArrayList
();
vcodeList
.
add
(
vcodesArr
);
}
CheckODRelationOV
checkODRelationOV
=
checkODRelation
(
bomcode
,
productgroupcode
,
vcodeList
,
dataSourceFlag
);
MessageJson
mj
=
new
MessageJson
();
mj
.
setFlag
(
checkODRelationOV
.
getResult
());
mj
.
setMessage
(
checkODRelationOV
.
getMessage
());
return
mj
;
}
//检查常规特配配置结果的OD关系
private
CheckODRelationOV
checkODRelation
(
String
bomCode
,
String
productGroupCode
,
ArrayList
characteristicValueCodes
,
String
dataSourceFlag
)
{
CheckODRelationOV
checkODRelationOV
=
new
CheckODRelationOV
();
List
<
ODRelationModel
>
odRelationList
=
odDataService
.
getODRelationList
(
productGroupCode
,
bomCode
,
dataSourceFlag
);
if
(
odRelationList
==
null
)
{
checkODRelationOV
.
setMessage
(
""
);
checkODRelationOV
.
setResult
(
true
);
return
checkODRelationOV
;
}
for
(
ODRelationModel
relation
:
odRelationList
)
{
//检查特征值列表是否满足OD关系
//依赖关系
if
(
relation
.
getType
()
==
1
)
{
//如果存在关联特征值
if
(!
StringUtil
.
isNullOrEmpty
(
relation
.
getSecondR3Code
()))
{
if
(
isValueInList
(
relation
.
getFirstR3VCode
(),
characteristicValueCodes
)
&&
isValueInList
(
relation
.
getSecondR3VCode
(),
characteristicValueCodes
)
&&
!
isValueInList
(
relation
.
getRelatedR3VCode
(),
characteristicValueCodes
))
{
checkODRelationOV
.
setMessage
(
relation
.
getDescription
());
checkODRelationOV
.
setResult
(
false
);
return
checkODRelationOV
;
}
}
else
{
//如果不存在关联特征值
if
(
isValueInList
(
relation
.
getFirstR3VCode
(),
characteristicValueCodes
)
&&
!
isValueInList
(
relation
.
getRelatedR3VCode
(),
characteristicValueCodes
))
{
checkODRelationOV
.
setMessage
(
relation
.
getDescription
());
checkODRelationOV
.
setResult
(
false
);
return
checkODRelationOV
;
}
}
}
else
{
//如果存在关联特征值
if
(!
StringUtil
.
isNullOrEmpty
(
relation
.
getSecondR3Code
()))
{
if
(
isValueInList
(
relation
.
getFirstR3VCode
(),
characteristicValueCodes
)
&&
isValueInList
(
relation
.
getSecondR3VCode
(),
characteristicValueCodes
)
&&
isValueInList
(
relation
.
getRelatedR3VCode
(),
characteristicValueCodes
))
{
checkODRelationOV
.
setMessage
(
relation
.
getDescription
());
checkODRelationOV
.
setResult
(
false
);
return
checkODRelationOV
;
}
}
else
{
//如果不存在关联特征值
if
(
isValueInList
(
relation
.
getFirstR3VCode
(),
characteristicValueCodes
)
&&
isValueInList
(
relation
.
getRelatedR3VCode
(),
characteristicValueCodes
))
{
checkODRelationOV
.
setMessage
(
relation
.
getDescription
());
checkODRelationOV
.
setResult
(
false
);
return
checkODRelationOV
;
}
}
}
}
checkODRelationOV
.
setMessage
(
""
);
checkODRelationOV
.
setResult
(
true
);
return
checkODRelationOV
;
}
//检查一个特征值是否包含在列表中
private
boolean
isValueInList
(
String
characteristicValueCode
,
ArrayList
characteristicValueCodes
)
{
if
(
StringUtil
.
isNullOrEmpty
(
characteristicValueCode
))
{
return
false
;
}
for
(
Object
objectCharacteristicValueCode
:
characteristicValueCodes
)
{
if
(
characteristicValueCode
.
equals
(
objectCharacteristicValueCode
))
{
return
true
;
}
}
return
false
;
}
}
src/main/java/cn/com/uitech/config/vo/CheckODRelationOV.java
0 → 100644
View file @
5ddf32e1
package
cn
.
com
.
uitech
.
config
.
vo
;
import
lombok.*
;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public
class
CheckODRelationOV
{
private
Boolean
result
;
private
String
message
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment