Commit 9523aa56 by yangkuo

getData接口跑通,提交v1.1.1

parent 12b89bdd
......@@ -12,7 +12,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<version>2.1.5.RELEASE</version>
<relativePath/>
</parent>
......@@ -85,12 +85,24 @@
<groupId>tk.mybatis</groupId>
<artifactId>mapper-base</artifactId>
<version>1.1.5</version>
<exclusions>
<exclusion>
<artifactId>persistence-api</artifactId>
<groupId>javax.persistence</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-core</artifactId>
<version>1.1.5</version>
<exclusions>
<exclusion>
<artifactId>persistence-api</artifactId>
<groupId>javax.persistence</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......@@ -135,10 +147,6 @@
<version>2.9.0</version>
</dependency>
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
......@@ -150,8 +158,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
......@@ -167,18 +173,6 @@
<artifactId>postgresql</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!-- <version>3.4.6</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
......@@ -189,11 +183,30 @@
<artifactId>fastjson</artifactId>
<version>1.2.73</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>tk.mybatis</groupId>-->
<!-- <artifactId>mapper-spring-boot-autoconfigure</artifactId>-->
<!-- <version>2.1.5</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.13</version>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
......
......@@ -6,14 +6,12 @@ import cn.com.uitech.common.utils.IPUtils;
import cn.com.uitech.common.utils.JwtUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Base64Util;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.util.Base64Utils;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
......@@ -21,8 +19,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
......@@ -42,6 +38,7 @@ public class JwtLoginFilter extends UsernamePasswordAuthenticationFilter {
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
try {
//从输入流中获取用户名和密码,而不是表单
System.out.println(bCryptPasswordEncoder.encode("123"));
SysUser sysUser = new ObjectMapper().readValue(request.getInputStream(), SysUser.class);
UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(sysUser.getUsername(),sysUser.getPassword());
return authenticationManager.authenticate(authRequest);
......
package cn.com.uitech.authorization.pojo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import javax.persistence.Column;
......@@ -43,6 +40,8 @@ public class SysUser implements UserDetails {
@Column(nullable = false)
private String password;
/**
* 状态
*/
......
......@@ -40,7 +40,7 @@ public class CtoBomServiceImpl implements CtoBomService {
@Value("${spring.redis.cto-database}")
private int ctoRedisDbNumber;
@Value("${spring.redis.database}")
@Value("${spring.redis.db-database}")
private int mainRedisDbNumber;
@Autowired
......
package cn.com.uitech.config.config;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import javax.sql.DataSource;
@Profile("!test")
@Configuration
public class DataSourceConfiguration {
@Primary
@Bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSourceProperties lmsDataSourceProperties() {
return new DataSourceProperties();
}
@Primary
@Bean
public DataSource lmsDataSource(@Qualifier("lmsDataSourceProperties") DataSourceProperties properties) {
DataSourceBuilder<?> dataSourceBuilder = properties.initializeDataSourceBuilder();
HikariDataSource build = dataSourceBuilder.type(HikariDataSource.class).build();
return build;
}
}
package cn.com.uitech.config.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManager;
import javax.sql.DataSource;
import java.util.Map;
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(entityManagerFactoryRef = "lmsEntityManagerFactory",
transactionManagerRef = "lmsTransactionManager",
basePackages = {"cn.com.uitech.config.repository"})
public class JPALMSConfiguration {
@Autowired
@Qualifier("lmsDataSource")
private DataSource lmsDataSource;
@Autowired
private JpaProperties jpaProperties;
@Autowired
private HibernateProperties hibernateProperties;
@Primary
@Bean(name = "lmsEntityManager")
public EntityManager lmsEntityManager(EntityManagerFactoryBuilder builder) {
return lmsEntityManagerFactory(builder).getObject().createEntityManager();
}
@Primary
@Bean(name = "lmsEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean lmsEntityManagerFactory(EntityManagerFactoryBuilder builder) {
Map<String, String> properties = jpaProperties.getProperties();
return builder.dataSource(lmsDataSource)
.properties(hibernateProperties.determineHibernateProperties(properties, new HibernateSettings()))
.packages("cn.com.uitech.config.entity")
.persistenceUnit("lmsPersistenceUnit")
.build();
}
@Primary
@Bean(name = "lmsTransactionManager")
public PlatformTransactionManager lmsTransactionManager(EntityManagerFactoryBuilder builder) {
return new JpaTransactionManager(lmsEntityManagerFactory(builder).getObject());
}
}
package cn.com.uitech.config.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
@Profile("!test")
@Configuration
public class RedisConfiguration {
@Bean
public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate template = new RedisTemplate();
template.setConnectionFactory(connectionFactory);
template.afterPropertiesSet();
return template;
}
}
package cn.com.uitech.config.constant;
import lombok.Getter;
/**
* @author leafinsight
*/
@Getter
public class GlobalConstant {
/**
* 默认的基准机型
*/
public static String BASIC_MACHINE_DEFAULT = "default";
/**
* 请选择的value值
*/
public static String CHARACTERISTIC_TBD_VALUE = "0";
/**
* 属性的尾货Key值
*/
public static String ATTRIBUTE_KEY_TAIL = "tail";
public static String ATTRIBUTE_KEY_DESCRIPTION = "description";
public static String ATTRIBUTE_KEY_PRE_SALE = "pre_sale";
public static String ATTRIBUTE_KEY_SALEABLE = "sale_able";
public static String ATTRIBUTE_KEY_RIGID_COMPONENTS = "rigid_components";
public static String ATTRIBUTE_KEY_RIGID_COMPONENTS_AMOUNT="internal_audience_amount";
public static String ATTRIBUTE_KEY_EP_NUMBER = "ep_number";
public static String ATTRIBUTE_KEY_ORDER_NUMBER = "order_number";
public static String ATTRIBUTE_KEY_DARK_DELIVERY = "dark_delivery";
public static String ATTRIBUTE_KEY_CONTROLLED_TYPE = "controlled_type";
public static String ATTRIBUTE_KEY_INTERNAL_AUDIENCE="internal_audience";
/**
* 属性的fast path值
*/
public static String ATTRIBUTE_KEY_FAST_PATH = "fast_path";
/**
* 属性的是否获取供应信息的值
*/
public static String ATTRIBUTE_KEY_INCLUDE_ATS = "include_ats";
//OD关系缓存Key
public final static String OD_REALTED_KEY="od_related";
//variant_table关系缓存Key
public final static String VARIANT_TABLE_KEY="variant_table";
}
package cn.com.uitech.config.controller;
import cn.com.uitech.config.dto.BomInitializeInputV2DTO;
import cn.com.uitech.config.dto.BomInitializeOutputV2DTO;
import cn.com.uitech.config.service.ConfiguratorService;
import cn.com.uitech.config.service.ConfiguratorV2Service;
import cn.com.uitech.config.utils.BusinessKeyHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
//import com.lenovo.mstool.client.auth.provider.IgnoreServiceAuth;
/**
* @author leafinsight
*/
@Api(value = "/api/v2/configurator", tags = "选配器(V2)模块")
@RestController
@RequestMapping(value = "/v2")
public class ConfiguratorV2Controller {
@Autowired
private ConfiguratorService configuratorService;
@Autowired
private ConfiguratorV2Service configuratorV2Service;
@Autowired
private BusinessKeyHelper businessKeyHelper;
@ApiOperation(value = "初始化", notes = "初始化")
@PostMapping(value = "/getData")
@ResponseStatus(HttpStatus.OK)
// @BizLog(action = "初始化")
public BomInitializeOutputV2DTO getDataWithName(@RequestBody BomInitializeInputV2DTO bomInitializeInputV2DTO) throws Exception {
return configuratorV2Service.getBasicDataWithName(bomInitializeInputV2DTO,
businessKeyHelper.getTokenByBusinessKey(bomInitializeInputV2DTO.getBusinessKey()),
businessKeyHelper.getDataSourceFlag(bomInitializeInputV2DTO.getBusinessKey()));
}
}
package cn.com.uitech.config.dto;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class AttributesBeanDTO {
private String key;
private String value;
}
package cn.com.uitech.config.dto;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class BasicBOMInfo {
private String bomCode;
private String division;
}
package cn.com.uitech.config.dto;
//import com.lenovo.ccb.common.annotation.Key;
//import com.lenovo.ccb.common.annotation.Module;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
//@Module("选配器加载")
public class BomInitializeInputV2DTO implements Serializable {
/**
* BusinessKey : FastQuote
* Division : 03
* BomCode : 10NCCTO1WW
* cdbId : 69
* DataType : 0
* role : sales,agent,productManager
* referenceModelIndex : "",不自动选中默认机型,default=默认机型的索引,可以支持多套默认机型
* needDescription :
* Token :
*/
// @Key(index=1,description = "业务关键字")
@ApiModelProperty(value = "businessKey", name = "businessKey",example = "业务关键字")
private String businessKey;
@ApiModelProperty(value = "division", name = "division",example = "产品组 03")
private String division;
@ApiModelProperty(value = "bomCode", name = "bomCode",example = "物料编号 10SXCTO1WW")
private String bomCode;
// @Key(index=2,description = "操作人")
@ApiModelProperty(value = "userCode", name = "userCode",example = "操作人 xxxx")
private String userCode;
@ApiModelProperty(value = "role", name = "role",example = "缓存角色")
private String role;
@ApiModelProperty(value = "referenceModel", name = "referenceModel",example = "参考模型")
private String referenceModel;
@ApiModelProperty(value = "needDescription", name = "needDescription",example = "needDescription")
private Boolean needDescription;
@ApiModelProperty(value = "configId", name = "configId",example = "configId")
private String configId;
@ApiModelProperty(value = "attributes", name = "attributes",example = "attributes")
private List<AttributesBeanDTO> attributes;
@ApiModelProperty(value = "token", name = "token",example = "token")
private String token;
}
package cn.com.uitech.config.dto;
//import com.fasterxml.jackson.annotation.JsonInclude;
//import com.lenovo.ccb.common.annotation.Module;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.List;
/**
* @author leafinsight
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
//@Module("configurator-service")
public class BomInitializeOutputV2DTO {
@ApiModelProperty(value = "materialNumber", name = "materialNumber", example = "物料编号 10SXCTO1WW")
private String materialNumber;
@ApiModelProperty(value = "产品组", name = "divisionCode", example = "产品组 03")
private String divisionCode;
@ApiModelProperty(value = "特征", name = "characteristicList", example = "特征")
private List<CharacteristicBean> characteristicList;
@ApiModelProperty(value = "特征值", name = "activeValues", example = "特征值")
private List<CharacteristicValuesBean> activeValues;
@ApiModelProperty(value = "默认特征值", name = "defaultValues", example = "默认特征值")
private List<PreValidationInputV2DTO.SelectedCharacteristicBean> defaultValues;
@ApiModelProperty(value = "选中特征值", name = "activeValues", example = "选中特征值")
private List<PreValidationInputV2DTO.SelectedCharacteristicBean> selectedValues;
@ApiModelProperty(value = "价格", name = "prices", example = "价格")
private List<PriceBean> prices;
@ApiModelProperty(value = "特性", name = "attributes", example = "特性")
private List<AttributeBean> attributes;
@ApiModelProperty(value = "结果", name = "result", example = "结果 true false 03")
private Boolean result;
@ApiModelProperty(value = "错误提示", name = "message", example = "错误提示")
private String message;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class CharacteristicBean {
@ApiModelProperty(value = "LMS特征编码", name = "lmsCode", example = "LMS特征编码")
private String lmsCode;
@ApiModelProperty(value = "特征编码", name = "code", example = "特征编码")
private String code;
@ApiModelProperty(value = "特征中文名称", name = "name", example = "特征中文名称")
private String name;
@ApiModelProperty(value = "特征英文名称", name = "特征英文名称", example = "特征英文名称")
private String engName;
@ApiModelProperty(value = "排序", name = "seq", example = "排序")
private int seq;
@ApiModelProperty(value = "数量配对特征", name = "pairCode", example = "数量配对特征")
private String pairCode;
@ApiModelProperty(value = "是否参与OD(对象依赖)验证", name = "restrict", example = "是否参与OD(对象依赖)验证 X:参与 空:不参与")
private String restrict; //entryRequired
@ApiModelProperty(value = "模式 数量型C 1:数量 0非", name = "mode", example = "模式 数量型C 1:数量 0非")
private Integer mode;
@ApiModelProperty(value = "技术隐藏 WindChill 隐藏 1:隐藏 0:显示", name = "technicalHidden", example = "产品设计即是隐藏或显示,0标识显示,1隐藏")
private int technicalHidden; //r3hidden
@ApiModelProperty(value = "销售隐藏 1:隐藏 0:显示", name = "salesHidden", example = "因销售规则而定义的显示与隐藏,0显示,1标识LMS隐藏,2标识E采隐藏...")
private int salesHidden;
@ApiModelProperty(value = "特征优先级 ", name = "priority", example = "特征分层 区分主要特征,次要特征")
private int priority;
private String entryRequired;
private List<CharacteristicValueBean> characteristicValues;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class CharacteristicValueBean {
@ApiModelProperty(value = "LMS特征值编码", name = "lmsCode", example = "LMS特征值编码")
private String lmsCode;
@ApiModelProperty(value = "特征值编码", name = "code", example = "特征值编码")
private String code;
@ApiModelProperty(value = "特征值名称", name = "name", example = "特征值名称")
private String name;
@ApiModelProperty(value = "特征值英文名称", name = "engName", example = "特征值英文名称")
private String engName;
@ApiModelProperty(value = "排序", name = "seq", example = "排序")
private int seq;
@ApiModelProperty(value = "原生不可选", name = "disableAtAll", example = "原生不可选")
private Boolean disableAtAll;
@ApiModelProperty(value = "特性", name = "attributes", example = "特性")
private List<AttributeBean> attributes;
}
}
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class CharacteristicValuesBean {
private String characteristicCode;
private List<String> values;
}
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
private static class PriceBean {
private String name;
private double value;
}
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class AttributeBean {
private String key;
private String value;
}
}
package cn.com.uitech.config.dto;
//import com.lenovo.ccb.common.annotation.Key;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public class BrushConfigurationInputDTO {
// @Key(index=1,description = "业务关键字")
private String businessKey;
private String division;
private String bomCode;
// @Key(index=2,description = "操作人")
private String userCode;
private Long configId;
private String token;
private List<AttributesBeanDTO> attributes;
}
package cn.com.uitech.config.dto;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public class BrushConfigurationOutputDTO {
private Boolean result;
private String message;
private List<PreValidationInputV2DTO.SelectedCharacteristicBean> selectedCharacteristicList;
private List<BomInitializeOutputV2DTO.CharacteristicValuesBean> activeValues;
}
package cn.com.uitech.config.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Check515ThinkServerRequestDTO {
//"1:保存 2:进入非常规 3:非常规页面初始化 4:供应可行性和价格可行性 5、技术可行性",
private String checktype;
private String bomCode;
private String productGroupCode;
private String r3CCode;
private String r3VCode;
private String characteristicEnglishName;
private String characteristicValueEnglishName;
}
package cn.com.uitech.config.dto;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
//import com.lenovo.ccb.common.annotation.Key;
//import com.lenovo.ccb.common.annotation.Module;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
//@Module("前置验证")
public class PreValidationInputV2DTO {
/**
* BusinessKey : FastQuote
* Division : 03
* BomCode : 10NCCTO1WW
* R3Code :
* R3VCode :
* WithDerive :
* CVSelected : 36440:1,3018799:1
* Token :
*/
// @Key(index=1,description = "业务关键字")
private String businessKey;
private String division;
private String bomCode;
// @Key(index=2,description = "操作人")
private String userCode;
@ApiModelProperty(value = "role", name = "role",example = "缓存角色")
private String role;
private String characteristicCode;
private String characteristicValueCode;
private String withDeriveCharacteristic;
private List<SelectedCharacteristicBean> selectedCharacteristicList= Lists.newArrayList();
@ApiModelProperty(value = "attributes", name = "attributes",example = "attributes")
private List<AttributesBeanDTO> attributes= Lists.newArrayList();
private String token;
@Getter
@Setter
@NoArgsConstructor
public static class SelectedCharacteristicBean {
/**
* characteristicCode : 29961
* Value : 1
*/
private String characteristicCode;
private String characteristicValueCode;
private String characteristicEnglishName;
private String characteristicValueEnglishName;
private Boolean isVisible=false; //开放给客户可见
}
}
package cn.com.uitech.config.dto;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public class PreValidationOutputV2DTO {
private List<BomInitializeOutputV2DTO.CharacteristicValuesBean> activeValues;
private String message;
private Boolean result;
}
package cn.com.uitech.config.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SearchSYCheckResponseDTO {
private List<BomServiceMappingResponseDTO> thinkData;
private List<SIYINCVMappingResponseDTO> syData;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class BomServiceMappingResponseDTO {
private String bomCode;
private String divisionCode;
private String characteristicEnglishName;
private String characteristicValueEnglishName;
}
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class SIYINCVMappingResponseDTO {
private String bomCode;
private String characteristicEnglishName;
private String characteristicValueEnglishName;
}
}
package cn.com.uitech.config.dto.ats;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
/**
* @author leafinsight
*/
@SuppressWarnings("ALL")
@NoArgsConstructor
@Data
@Getter
@Setter
public class ATSResponseDTO {
/**
* success : true
* result : {"ATS":[{"DIVISION":"03","CTO":"098000018","Land":"PRC","CVVKs":[{"Atnam":"机箱","Atwrt":"slim Rambo 8300","Supply":[{"Period":"第1周","Color":"R红,Y黄,G绿","Count":80520},{"Period":"2","Color":"N","Count":30000},{"Period":"3","Color":"N","Count":60000},{"Period":"4","Color":"N","Count":174260},{"Period":"5","Color":"N","Count":122160}]}]}]}
* resultMessage : null
* resultCode : null
*/
private Boolean success;
private List<ResultBean> result;
private String resultMessage;
private String resultCode;
@NoArgsConstructor
@Data
@Getter
@Setter
public static class ResultBean {
private List<ATSBean> ATS;
@NoArgsConstructor
@Data
@Getter
@Setter
public static class ATSBean {
/**
* DIVISION : 03
* CTO : 098000018
* Land : PRC
* CVVKs : [{"Atnam":"机箱","Atwrt":"slim Rambo 8300","Supply":[{"Period":"第1周","Color":"R红,Y黄,G绿","Count":80520},{"Period":"2","Color":"N","Count":30000},{"Period":"3","Color":"N","Count":60000},{"Period":"4","Color":"N","Count":174260},{"Period":"5","Color":"N","Count":122160}]}]
*/
private String DIVISION;
private String CTO;
private String Land;
private List<CVVKsBean> CVVKs;
@NoArgsConstructor
@Data
@Getter
@Setter
public static class CVVKsBean {
/**
* Atnam : 机箱
* Atwrt : slim Rambo 8300
* Supply : [{"Period":"第1周","Color":"R红,Y黄,G绿","Count":80520},{"Period":"2","Color":"N","Count":30000},{"Period":"3","Color":"N","Count":60000},{"Period":"4","Color":"N","Count":174260},{"Period":"5","Color":"N","Count":122160}]
*/
private String Atnam;
private String Atwrt;
private List<SupplyBean> Supply;
@NoArgsConstructor
@Data
@Getter
@Setter
public static class SupplyBean {
/**
* Period : 第1周
* Color : R红,Y黄,G绿
* Count : 80520
*/
private String Period;
private String Color;
private Integer Count;
}
}
}
}
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class BOMCVNameVM {
/**
* r3Code : 0000029961
* r3EName : Processor
* name : CPU
* characteristicCode : 10BWCTO1WW0002043946
*/
private String r3Code;
private String r3EName;
private String name;
private String characteristicCode;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class BasicBOMInfo {
private String bomCode;
private String division;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class BasicDataBOM implements Serializable {
private BigDecimal agentPrice;
private BigDecimal boCostPrice;
private String retPrice;
private Integer specialPathType;
private Integer bomNewType;
private Integer hasNumC;
private BigDecimal actualCostPrice;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class BasicDataProperty implements Serializable {
private String characteristicCode;
private String r3Code;
private String r3EName;
private String name;
private Integer r3Hiden; //特征是否隐藏
private Integer visibleType; //可见隐藏
private String entryRequired;
private String qtyR3Code;
private Integer characterType;
private Integer b2bVisibleType;
private String url;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class BasicDataPropertyValue implements Serializable {
private String characteristicValueCode;
private String characteristicCode;
private String r3Code;
private String r3VCode;
private String r3EName;
private String name;
private Integer isDefault;
private Integer salesVisible;
private Integer isPresale;
private Integer status;
private Integer isBOPStep;
private Integer bopStepAmount;
private BigDecimal agentPrice;
private BigDecimal boCostPrice;
private String retPrice;
private String description;
private String residuaStatus;
private Integer epNumber;
private Integer orderNumber;
private String productSwop;
private Date updateTime;
private Date presaleStartDate;
private Date presaleEndDate;
private Integer vSequence;
private Integer characterType;
private Integer b2bVisible;
private Integer isAllow;
private Integer internalAudience;
private BigDecimal actualCostPrice;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class BomCode {
private String bomCode;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class BomCodeStatus {
private String bomCode;
private String npStatus;
private String syStatus;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class BomServiceMapping {
private String bomCode;
private String productGroupCode;
private String r3CEName;
private String r3VEName;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class BomThinkServiceMappingCVE {
private String r3VEName;
private String mapR3VEName;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class CTODefaultCV {
private String r3Code;
private String r3VCode;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class CTONonVTC {
private String r3Code;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.joda.time.DateTime;
@Getter
@Setter
@NoArgsConstructor
public class CTOQTYCMapping {
private String r3Code;
private String qtyR3Code;
private DateTime createDate;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class CTOTotalQTYMapping {
private String allowedQTYChar;
private String totalQTYChar;
private String qtyChar;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class CTOUniqueVT {
private String r3Code;
}
package cn.com.uitech.config.entity;
public interface CharactR3CodeValue {
String getCharacteristicValueCode();
String getCharacteristicCode();
String getCharacteristicName();
String getProductGroupCode();
String getR3Name();
String getR3Code();
String getR3VCode();
String getR3EName();
String getName();
String getAgentPrice();
String getBoCostPrice();
Integer getSequence();
Integer getStatus();
Integer getIsDefault();
String getDescription();
String getPriceId();
Integer getIsPresale();
String getPresaleStartDate();
String getPresaleEndDate();
String getUpdateTime();
String getR3Hiden();
}
package cn.com.uitech.config.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "Characteristic")
public class Characteristic {
@Id
@Column(name = "CharacteristicCode")
private String characteristicCode;
@Column(name = "R3Code", columnDefinition = "char")
private String r3Code;
}
package cn.com.uitech.config.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExportConfiguration {
@Column(name = "configId")
private Long configId;
@Column(name = "bomCode")
private String bomCode;
@Column(name = "divisionCode")
private String divisionCode;
@Column(name = "CharacteristicCode")
private String characteristicCode;
@Column(name = "CharacteristicValueCode")
private String characteristicValueCode;
@Column(name = "characteristicName")
private String characteristicName;
@Column(name = "characteristicEnglishName")
private String characteristicEnglishName;
@Column(name = "characteristicValueName")
private String characteristicValueName;
@Column(name = "characteristicValueEnglishName")
private String characteristicValueEnglishName;
@Column(name = "entryRequired")
private String entryRequired;
@Column(name = "quantity")
private String quantity;
@Column(name = "CharacterType")
private String characterType;
@Column(name = "isDefault")
private String isDefault;
}
package cn.com.uitech.config.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
* @author leafinsight
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Table(name = "Configurator_ModelBasicInfo")
public class ModelBasicInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id")
private Long id;
@Column(name = "DivisionCode")
private String division;
@Column(name = "BOMCode")
private String bomCode;
@Column(name = "UserCode")
private String userCode;
@Column(name = "CreateTime")
private Date createTime;
@Column(name = "SourceId")
private String sourceId;
@Transient
private List<ModelConfiguration> modelConfigurations;
}
package cn.com.uitech.config.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
/**
* @author leafinsight
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Table(name = "Configurator_ModelConfiguration")
public class ModelConfiguration {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id")
private Long id;
@Column(name = "configId")
private Long configId;
@Column(name = "CharacteristicCode")
private String characteristicCode;
@Column(name = "CharacteristicValueCode")
private String characteristicValueCode;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ODAllValue {
private String bomCode;
private String r3Name;
private String cName;
private String condition;
private String r3Code;
private String r3VCode;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ODChar {
private Integer idVT;
private Integer field;// 用户姓名
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
@Getter
@Setter
@NoArgsConstructor
public class ODConstrain {
private Integer id;
private String vtName;
private BigDecimal percentage;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
public class ODData implements Serializable {
private Integer idVT;
private List<String> aryChar;
/**
* 第一索引是行号,第二索引是特征,第三个集合是特征值集合
*/
private Map<Integer, Map<String, List<String>>> aryData;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ODValue {
private Integer id;
private Integer linecode;// 用户的姓名
private Integer r3Code;// 性别
private Integer r3VCode;// 地址
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class ProcTotlResult {
private boolean result;
private List<String> cvForceList;
private List<String> cvList;
}
package cn.com.uitech.config.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
/**
* @author leafinsight
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReferenceConfiguration {
@Column(name = "configId")
private Long configId;
@Column(name = "bomCode")
private String bomCode;
@Column(name = "divisionCode")
private String divisionCode;
@Column(name = "CharacteristicCode")
private String characteristicCode;
@Column(name = "CharacteristicValueCode")
private String characteristicValueCode;
@Column(name = "characteristicName")
private String characteristicName;
@Column(name = "characteristicEnglishName")
private String characteristicEnglishName;
@Column(name = "characteristicValueName")
private String characteristicValueName;
@Column(name = "characteristicValueEnglishName")
private String characteristicValueEnglishName;
@Column(name = "entryRequired")
private String entryRequired;
@Column(name = "quantity")
private String quantity;
@Column(name = "CharacterType")
private String characterType;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
public class SpecialR3Code {
//@Column(name="VTName")
private String variantTableName;
//@Column(name="R3CODE")
private String r3Code;
//@Column(name="Total_Qty_Char")
private String totalQtyChar;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class UserQuit {
private String userCode;
}
package cn.com.uitech.config.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.Date;
/**
* @author leafinsight
*/
@Getter
@Setter
@NoArgsConstructor
public class VTAndVUpdate {
private String bomCode;
private String division;
private Date updateTime;
private String operator;
}
package cn.com.uitech.config.enums;
public enum AttributesType {
CDBID("cdbid"),
MODE("mode"),
DATA_TYPE("dataType"),
ROLE_VISIABLE_TYPE("roleVisibleType");
private String attributesType;
private AttributesType(String value) {
attributesType = value;
}
public String getValue() {
return attributesType;
}
}
package cn.com.uitech.config.enums;
public enum BOMNewType {
OldType(1), NewType(2);
private int mState;
private BOMNewType(int value) {
mState = value;
}
public int BOMNewType() {
return mState;
}
}
package cn.com.uitech.config.enums;
public enum CharacterType {
Char(0), Num(1);
private int characterType;
private CharacterType(int value) {
characterType = value;
}
public int getCharacterType() {
return characterType;
}
}
package cn.com.uitech.config.enums;
public enum DefaultCharacteristicValue {
NonDefault(0), Default(1);
private int mState;
private DefaultCharacteristicValue(int value) {
mState = value;
}
public int DefaultCharacteristicValue() {
return mState;
}
}
package cn.com.uitech.config.enums;
/**
* @author leafinsight
*/
public enum RoleVisibleType {
SALE_VISIBLE("SALES"),
PM_VISIBLE("PM"),
BP_VISIBLE("BP");
private String RoleVisibleType;
private RoleVisibleType(String value) {
RoleVisibleType = value;
}
public String getValue() {
return RoleVisibleType;
}
}
package cn.com.uitech.config.exception;
public class BadRequestException extends RuntimeException {
public BadRequestException(String message) {
super(message);
}
}
package cn.com.uitech.config.exception;
public class InvalidRequestException extends RuntimeException {
public InvalidRequestException(String message) {
super(message);
}
}
package cn.com.uitech.config.exception;
public class ResourceNotFoundException extends RuntimeException {
public ResourceNotFoundException(String message) {
super(message);
}
}
package cn.com.uitech.config.repository;
import cn.com.uitech.config.entity.CharactR3CodeValue;
import cn.com.uitech.config.entity.Characteristic;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CharacteristicRepository extends JpaRepository<Characteristic, String> {
@Query(nativeQuery = true, value = "exec sp_FollowR3Code :bomCode")
List<String> getFollowR3Code(@Param("bomCode") String bomCode);
@Query(nativeQuery = true,value = "select * from sp_FollowR3Code(:bomCode)")
List<String>getFollowR3CodeForPostGreSql(@Param("bomCode") String bomCode);
@Query(nativeQuery = true, value = "select * from up_ProductInfo_GetCharactR3CodeValueByCodeAndPGCode(:bomCode, :pgCode)")
List<CharactR3CodeValue> getCharacteristicR3CodeTableByBomCodeAndPGCode(@Param("bomCode") String bomCode,
@Param("pgCode") String pgCode);
}
package cn.com.uitech.config.repository;
import cn.com.uitech.config.dto.Check515ThinkServerRequestDTO;
import cn.com.uitech.config.entity.*;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.StatementType;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Mapper
@Repository
public interface ConfiguratorRepository {
List<List<?>> getVariantTable(Map map);
List<ODValue>getVariantTable01Part1(Map map);
List<ODChar> getVariantTable01Part2(Map map);
List<ODConstrain>getVariantTable01Part3(Map map);
List<?>getCharacteristicValues3(Map map);
List<?>getCharacteristicValues4(Map map);
List<?>getCharacteristicValues5(Map map);
List<List<?>> getPCBOMDefaultCV(Map map);
List<?> getPcbomdefaultcvPart1(Map map);
List<?> getPcbomdefaultcvPart2(Map map);
List<?> getPcbomdefaultcvPart3(Map map);
List<List<?>> getCharacteristicItemsByBomCode(Map map);
List<List<?>> getCharacteristicItemsByBomCodeV2(Map map);
List<?> getVariantR3Code(Map map);
@Select("{ call up_SpecialR3Code(#{bomCode, jdbcType=VARCHAR, mode=IN}) }")
@Options(statementType = StatementType.CALLABLE)
@Results({
@Result(property = "variantTableName", column = "VTName"),
@Result(property = "r3Code", column = "R3CODE"),
@Result(property = "totalQtyChar", column = "Total_Qty_Char"),
})
List<SpecialR3Code> getSpecialR3Code(@Param("bomCode") String bomCode);
List<List<?>> getAllBomOD(Map map);
List<List<?>> getBomCV(Map map);
List<BasicBOMInfo> getBOMListByDivision(Map map);
List<BasicBOMInfo> test(@Param("Test1") String test, @Param("TPM") List<BasicBOMInfo> aryTPM);
List<BOMCVNameVM> getBOMCVNameVMByCode(Map bomCode);
List<UserQuit> getUserQuit();
@Select("select R3Code as r3Code,QTYR3Code as qtyR3Code,CreateDate as createDate from CTOQTYCMapping")
List<CTOQTYCMapping> getCTOQTYCMapping();
@Select("select Allowed_Qty_Char as allowedQTYChar,Total_Qty_Char as totalQTYChar,Qty_Char as qtyChar from CTOTotalQTYMapping")
List<CTOTotalQTYMapping> getCTOTotalQTYMapping();
@Select("select BOMCode as bomCode,ProductGroupCode as division,UpdateTime as updateTime,Operator as operator from VTAndVUpdate")
List<VTAndVUpdate> getVTAndVUpdate();
@Insert("insert into configurator_modelbasicinfo(divisionCode,bomCode,userCode,createTime,sourceId) values (" +
" #{modelBasicInfo.division}, " +
" #{modelBasicInfo.bomCode}, " +
" #{modelBasicInfo.userCode}, " +
" #{modelBasicInfo.createTime}," +
" #{modelBasicInfo.sourceId})" )
@Options(useGeneratedKeys=true, keyProperty = "modelBasicInfo.id", keyColumn="id")
void insertModelBasicInfo(@Param("modelBasicInfo") ModelBasicInfo modelBasicInfo);
@Insert({"<script>",
"insert into configurator_modelconfiguration(configId,characteristicCode,characteristicValueCode) values " +
"<foreach collection='modelConfigurations' item='modelConfiguration' index='index' open='(' separator='),(' close=')'>" +
" #{modelConfiguration.configId}, " +
" #{modelConfiguration.characteristicCode}, " +
" #{modelConfiguration.characteristicValueCode}" +
"</foreach>",
"</script>"})
void insertModelConfiguration(@Param("modelConfigurations") List<ModelConfiguration> modelConfigurations);
@Select("select characteristicCode, characteristicValueCode from Configurator_ModelConfiguration where ConfigId='${configId}' ")
List<ModelConfiguration> getModelConfiguration(@Param("configId") Long configId);
@Select("select b.BOMCode as bomCode,b.DivisionCode as divisionCode,d.R3Code as characteristicCode, d.r3vcode as characteristicValueCode,\n" +
" c.Name as characteristicName,c.R3EName as characteristicEnglishName,\n" +
"\t\t\td.Name as characteristicValueName,d.R3EName as characteristicValueEnglishName,c.EntryRequired as entryRequired,1 as quantity,c.CharacterType as characterType\n" +
" from Configurator_ModelConfiguration\n" +
" a with(nolock) inner join Configurator_ModelBasicInfo b with(nolock) on a.ConfigId=b.Id\n" +
" inner join Characteristic c with(nolock) on b.BOMCode=c.BOMCode and b.DivisionCode=c.ProductGroupCode and right(concat('0000000000',a.characteristicCode),10) = c.R3Code\n" +
" inner join CharacteristicValue d with(nolock) on c.CharacteristicCode=d.CharacteristicCode and right(concat('0000',a.characteristicValueCode),4) = right(d.r3vcode,4)\n" +
" where ConfigId='${configId}' ")
List<ReferenceConfiguration> getConfigurationsByConfigId(@Param("configId") Long configId);
@Select("{call up_configurator_getConfigurationByConfigId(" +
"#{configIds, jdbcType=VARCHAR, mode=IN}" +
") }")
@Options(statementType = StatementType.CALLABLE)
List<ReferenceConfiguration> searchConfigurationByConfigId(@Param("configIds") String configIds);
@Select("{call up_pcap_configurator_copy(" +
"#{Guid, jdbcType=VARCHAR, mode=IN}, " +
"#{UserCode, jdbcType=VARCHAR, mode=IN}, " +
"#{ConfigIds, jdbcType=VARCHAR, mode=IN} " +
") }")
@Options(statementType = StatementType.CALLABLE)
List<String> copyConfiguration(@Param("Guid") String guid,
@Param("UserCode") String userCode,
@Param("ConfigIds") String configIds);
@Select("{call up_pcap_configurator_ExportConfigurationByConfigId(" +
"#{configIds, jdbcType=VARCHAR, mode=IN}" +
") }")
@Options(statementType = StatementType.CALLABLE)
List<ExportConfiguration> exportConfigurationByConfigId(@Param("configIds") String configIds);
List<List<?>>check515ThinkServer(@Param("check515ThinkServers") List<Check515ThinkServerRequestDTO> check515ThinkServers);
List<List<?>> searchSYCheckByBomCode(@Param("bomCode") String bomCode, @Param("divisionCode") String divisionCode);
List<?>searchSYCheckByBomCodeBomServiceMappingSY(@Param("bomCode") String bomCode, @Param("divisionCode") String divisionCode);
List<?>searchSYCheckByBomCodeBomServiceSIYINCVMapping(@Param("bomCode") String bomCode, @Param("divisionCode") String divisionCode);
}
package cn.com.uitech.config.repository;
import cn.com.uitech.config.entity.ModelBasicInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ModelBasicInfoRepository extends JpaRepository<ModelBasicInfo, Integer> {
ModelBasicInfo findById(Long id);
}
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.vo.BOMCVCacheVO;
import java.util.List;
import java.util.Map;
public interface ConfiguratorCacheService {
/**
* @return 物料的全部信息
*/
BOMCVCacheVO getCharacteristicItemsByBomCodeV2WithoutRedis(String token, String bomCode, String division, int cdbID, String type,
String dataType, int roleVisibleType,
String dataSourceFlag);
/**
* @return 物料的全部信息
*/
BOMCVCacheVO getCharacteristicItemsByBomCodeV2(String token, String bomCode, String division, int cdbID, String type, String dataType, int roleVisibleType, String dataSourceFlag) ;
/**
* @return 数量型C的映射关系
*/
List<CTOQTYCMapping> getCTOQTYCMapping(String dataSourceFlag);
/**
* @return OD信息
*/
Map<Integer, ODData> getVariantTable(String token, String bomCode, String division, String dataSourceFlag);
/**
* @return 数量型C和total的计算关系
*/
List<CTOTotalQTYMapping> getCTOTotalQTYMapping(String dataSourceFlag);
/**
* @return 返回特殊的特征
*/
List<SpecialR3Code> getSpecialR3Code(String token, String bomCode, String dataSourceFlag);
/**
* @return 从属特征
*/
List<String> getFollowR3Code(String token, String bomCode, String dataSourceFlag);
}
package cn.com.uitech.config.service;
public interface ConfiguratorService {
}
package cn.com.uitech.config.service;
import cn.com.uitech.config.dto.BomInitializeInputV2DTO;
import cn.com.uitech.config.dto.BomInitializeOutputV2DTO;
public interface ConfiguratorV2Service {
BomInitializeOutputV2DTO getBasicDataWithName(BomInitializeInputV2DTO bomInitializeInputV2DTO, String token, String dataSourceFlag) throws Exception ;
}
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 java.util.List;
public interface ODDataService {
List<List<?>> getCharacteristicItemsByBomCodeV2ForPostGreSql(String bomCode, String division, int cdbID, String type, String dataType, int visibleType, String dataSourceFlag) ;
List<CTOQTYCMapping> getCTOQTYCMapping(String dataSourceFlag);
/**
*
* @param bomCode 10位物料编号
* @param pgCode 产品组
* @param dataSourceFlag
* @return Table数据集合
*/
List<List<?>> getVariantTableForPostGreSql(String bomCode, String pgCode,String dataSourceFlag);
List<CTOTotalQTYMapping> getCTOTotalQTYMapping(String dataSourceFlag);
/// <summary>
/// 获取SpecialR3Code
/// </summary>
/// <param name="bomCode"></param>
/// <returns></returns>
List<SpecialR3Code> getSpecialR3Code(String bomCode, String dataSourceFlag);
/**
* @return 从属Cg
*/
List<String> getFollowR3Code(String bomCode, String dataSourceFlag);
}
package cn.com.uitech.config.service;
import cn.com.uitech.config.entity.ODData;
import cn.com.uitech.config.vo.BOMInitializeExResultVO;
import cn.com.uitech.config.vo.ConfigProcResultVO;
import java.util.List;
import java.util.Map;
public interface OdService {
/// <summary>
/// BOM加载VT过滤
/// </summary>
/// <param name="bomCode"></param>
/// <param name="aryCVS"></param>
/// <returns></returns>
BOMInitializeExResultVO bomInitializeEx(String bomCode, Map<String, List<Integer>> aryCVS, String division, Map<Integer, Map<Integer, Map<String, List<Integer>>>> aryVT, Map<Integer, List<Integer>> aryInvalidRow) ;
Map<Integer, ODData> getVariantTable(String token, String bomCode, String division, int type, Object obj, String dataSourceFlag) ;
/// <summary>
/// 前置选配器验证,并行方法
/// </summary>
/// <param name="R3Code"></param>
/// <param name="arySelectedCVSClon"></param>
/// <param name="aryCVS"></param>
/// <param name="aryVT"></param>
/// <param name="aryInvalidRow"></param>
/// <param name="allSelected"></param>
/// <returns></returns>
ConfigProcResultVO configuratorFilterFormalV2(String r3Code, Map<String, Integer> arySelectedCVSClon, Map<String, List<Integer>> aryCVS,
Map<Integer, Map<Integer, Map<String, List<Integer>>>> aryVT,
Map<Integer, List<Integer>> aryInvalidRow, boolean isNumBOM, List<String> aryFomulaC, List<String> aryHiddenC,
boolean allSelected, boolean withDerive, List<String> aryNeedCheck, List<String> aryTotalChar,
Map<String, Boolean> aryTotalSelect, List<String> aryFollowHiddenC, boolean isUC,
Map<String, List<String>> specialR3Code, Map<Integer, Map<String, List<String>>> aryUpgradeNonNum,
boolean clearSel, Map<String, String> aryQTYCMappingList);
/// <summary>
/// 返回某BOM对应的所有VTName中包含的C,group by VTName
/// </summary>
/// <param name="bomCode"></param>
/// <returns></returns>
List<String> getAllCharacteristic(Map<Integer, ODData> aryData);
/**
* 转化已选特征值到Map结构体
*
* @param cvSelected 选中的CV
* @return 获得选中的CV
*/
Map<String, Integer> getSelectedCV(String cvSelected) ;
/// <summary>
/// 前置检查返回的结果集是否包含页面已选中的特征值
/// </summary>
/// <param name="aryRelation"></param>
/// <param name="arySelected"></param>
/// <returns></returns>
boolean checkInclusion(Map<String, List<Integer>> aryRelation, Map<String, Integer> arySelected, List<String> aryHiddenC) ;
/// <summary>
/// 检查是否CTO的可见部分都已经选择
/// </summary>
/// <param name="arySelected">所有当前选中的</param>
/// <param name="aryChar">BOM的所有参与VT的特征</param>
/// <param name="aryHiddenC">隐藏的特征</param>
/// <returns></returns>
Boolean checkAllSelected(Map<String, Integer> arySelected, List<String> aryChar, List<String> aryHiddenC) ;
}
package cn.com.uitech.config.service.impl;
import cn.com.uitech.config.service.ConfiguratorService;
import org.springframework.stereotype.Service;
@Service
public class ConfiguratorServiceImpl implements ConfiguratorService {
}
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.repository.CharacteristicRepository;
import cn.com.uitech.config.repository.ConfiguratorRepository;
import cn.com.uitech.config.service.ODDataService;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class ODDataServiceImpl implements ODDataService {
@Autowired
private ConfiguratorRepository configuratorRepository;
@Autowired
private CharacteristicRepository characteristicRepository;
@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();
map.put("p1", bomCode);
map.put("p2", division);
map.put("p3", cdbID);
map.put("p4", type);
map.put("p5", dataType);
map.put("p6", visibleType);
List<?> basicDataProperty=configuratorRepository.getCharacteristicValues3(map);
List<?> basicDataPropertyValue=configuratorRepository.getCharacteristicValues4(map);
List<?>basicDataBOM=configuratorRepository.getCharacteristicValues5(map);
List<List<?>>list=new ArrayList<>();
list.add(basicDataProperty);
list.add(basicDataPropertyValue);
list.add(basicDataBOM);
return list;
}
@Override
public List<CTOQTYCMapping> getCTOQTYCMapping(String dataSourceFlag) {
return configuratorRepository.getCTOQTYCMapping();
}
/**
*
* @param bomCode 10位物料编号
* @param pgCode 产品组
* @param dataSourceFlag
* @return Table数据集合
*/
@Override
public List<List<?>> getVariantTableForPostGreSql(String bomCode, String pgCode,String dataSourceFlag) {
Map<String, String> map = Maps.newHashMap();
map.put("p1", bomCode);
map.put("p2", pgCode);
System.out.println(bomCode+":"+pgCode);
List<?> ODValue=configuratorRepository.getVariantTable01Part1(map);
List<?> ODChar=configuratorRepository.getVariantTable01Part2(map);
List<?>ODConstrain=configuratorRepository.getVariantTable01Part3(map);
List<List<?>> list=new ArrayList<>();
list.add(ODValue);
list.add(ODChar);
list.add(ODConstrain);
return list;
}
@Override
public List<CTOTotalQTYMapping> getCTOTotalQTYMapping(String dataSourceFlag) {
return configuratorRepository.getCTOTotalQTYMapping();
}
/// <summary>
/// 获取SpecialR3Code
/// </summary>
/// <param name="bomCode"></param>
/// <returns></returns>
@Override
public List<SpecialR3Code> getSpecialR3Code(String bomCode, String dataSourceFlag) {
return configuratorRepository.getSpecialR3Code(bomCode);
}
/**
* @return 从属Cg
*/
@Override
public List<String> getFollowR3Code(String bomCode, String dataSourceFlag) {
//return characteristicRepository.getFollowR3Code(bomCode);
return characteristicRepository.getFollowR3CodeForPostGreSql(bomCode);
}
}
package cn.com.uitech.config.utils;
import cn.com.uitech.config.dto.AttributesBeanDTO;
import cn.com.uitech.config.enums.AttributesType;
import cn.com.uitech.config.enums.RoleVisibleType;
import cn.com.uitech.config.vo.AttributesBeanVO;
import java.util.List;
public class AttributesBeanUtil {
public static AttributesBeanVO builderAttributesBeanVO(List<AttributesBeanDTO> attributes, String role) {
AttributesBeanVO attributesBeanVO = new AttributesBeanVO();
if (attributes != null && attributes.size() > 0) {
AttributesBeanDTO attributesBean = attributes.stream().filter(a -> AttributesType.CDBID.getValue().equals(a.getKey())).findFirst().orElse(null);
if (attributesBean != null) {
attributesBeanVO.setCdbid(Integer.parseInt(attributesBean.getValue()));
}
attributesBean = attributes.stream().filter(a -> AttributesType.DATA_TYPE.getValue().equals(a.getKey())).findFirst().orElse(null);
if (attributesBean != null) {
attributesBeanVO.setDataType(attributesBean.getValue());
}
attributesBean = attributes.stream().filter(a -> AttributesType.MODE.getValue().equals(a.getKey())).findFirst().orElse(null);
if (attributesBean != null) {
if (attributesBean.getValue().toLowerCase().equals("view")){
attributesBeanVO.setMode("view");
}
}
attributesBean = attributes.stream().filter(a -> AttributesType.ROLE_VISIABLE_TYPE.getValue().equals(a.getKey())).findFirst().orElse(null);
if (attributesBean != null) {
if (attributesBean.getValue().toUpperCase().equals(RoleVisibleType.PM_VISIBLE.getValue())) {
attributesBeanVO.setRoleVisibleType(1);
}
}
if(role != null)
{
if (role.toUpperCase().equals(RoleVisibleType.PM_VISIBLE.getValue())) {
attributesBeanVO.setRoleVisibleType(1);
}
}
}
return attributesBeanVO;
}
}
package cn.com.uitech.config.utils;
import cn.com.uitech.config.exception.InvalidRequestException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
@Configuration
public class BusinessKeyHelper {
@Value("${appSettings.lms.firstCachePrefix}")
private String firstCachePrefix;
@Value("${appSettings.lms.firstSystemArray}")
private String firstSystem;
@Value("${appSettings.lms.dataSourceFlag}")
private String dataSourceFlag;
@Value("${appSettings.smb.firstCachePrefix}")
private String firstCachePrefixSmb;
@Value("${appSettings.smb.firstSystemArray}")
private String firstSystemSmb;
@Value("${appSettings.smb.dataSourceFlag}")
private String dataSourceFlagSmb;
public String getTokenByBusinessKey(String businessKey) {
String token = "";
List<String> aryFirstSystem = Arrays.asList(this.firstSystem.split(","));
List<String> aryFirstSystemSmb = Arrays.asList(this.firstSystemSmb.split(","));
final Stream<String> stringStream = aryFirstSystem.stream().filter(p -> p.equalsIgnoreCase(businessKey));
if (stringStream.count() > 0) {
token = this.firstCachePrefix;
}else{
final Stream<String> stringStreamSmb = aryFirstSystemSmb.stream()
.filter(p -> p.equalsIgnoreCase(businessKey));
if (stringStreamSmb.count() > 0) {
token = this.firstCachePrefixSmb;
}
}
System.out.println("*********************token 校验:"+token+"_businessKey:"+businessKey);
if (StringUtil.isNullOrEmpty(token)) {
throw new InvalidRequestException("businessKey 无效!");
}
return token;
}
public String getDataSourceFlag(String businessKey) {
String dataSourceFlag = "";
List<String> aryFirstSystem = Arrays.asList(this.firstSystem.split(","));
List<String> aryFirstSystemSmb = Arrays.asList(this.firstSystemSmb.split(","));
final Stream<String> stringStream = aryFirstSystem.stream().filter(p -> p.equalsIgnoreCase(businessKey));
if (stringStream.count() > 0) {
dataSourceFlag = this.dataSourceFlag;
}else{
final Stream<String> stringStreamSmb = aryFirstSystemSmb.stream()
.filter(p -> p.equalsIgnoreCase(businessKey));
if (stringStreamSmb.count() > 0) {
dataSourceFlag = this.dataSourceFlagSmb;
}
}
if (StringUtil.isNullOrEmpty(dataSourceFlag)) {
throw new InvalidRequestException("businessKey 无效!");
}
return dataSourceFlag;
}
}
package cn.com.uitech.config.utils;
public class CastUtil {
@SuppressWarnings("unchecked")
public static <T> T cast(Object obj) {
return (T) obj;
}
}
package cn.com.uitech.config.utils;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 时间转换
*/
public class DateUtil {
/**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static Date getNowDate() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 获取现在时间
*
* @return返回字符串格式 yyyy-MM-dd HH:mm:ss
*/
public static String getStringDate() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
public static String getSecondStringDate() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取现在时间
*
* @return 返回短时间字符串格式yyyy-MM-dd
*/
public static String getStringDateShort() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取时间 小时:分;秒 HH:mm:ss
*
* @return
*/
public static String getTimeShort() {
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
Date currentTime = new Date();
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
* @param strDate
* @return
*/
public static Date strToDateLong(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
*
* @param dateDate
* @return
*/
public static String dateToStrLong(Date dateDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
* 将短时间格式时间转换为字符串 yyyy-MM-dd
*
* @param dateDate
* @param
* @return
*/
public static String dateToStr(Date dateDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
* 将短时间格式字符串转换为时间 yyyy-MM-dd
*
* @param strDate
* @return
*/
public static Date strToDate(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 得到现在时间
*
* @return
*/
public static Date getNow() {
Date currentTime = new Date();
return currentTime;
}
/**
* 提取一个月中的最后一天
*
* @param day
* @return
*/
public static Date getLastDate(long day) {
Date date = new Date();
long date_3_hm = date.getTime() - 3600000 * 34 * day;
Date date_3_hm_date = new Date(date_3_hm);
return date_3_hm_date;
}
/**
* 得到现在时间
*
* @return 字符串 yyyyMMdd HHmmss
*/
public static String getStringToday() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 得到现在小时
*/
public static String getHour() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String hour;
hour = dateString.substring(11, 13);
return hour;
}
/**
* 得到现在分钟
*
* @return
*/
public static String getTime() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String min;
min = dateString.substring(14, 16);
return min;
}
/**
* 根据用户传入的时间表示格式,返回当前时间的格式 如果是yyyyMMdd,注意字母y不能大写。
*
* @param sformat
* yyyyMMddhhmmss
* @return
*/
public static String getUserDate(String sformat) {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(sformat);
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 根据用户传入的时间格式、字符串,验证字符串是否符合传入的时间格式
*
* @param DateFormat 时间格式
* @param str 字符串
* @return true验证通过 false验证失败
*/
public static boolean isValidDate(String DateFormat, String str) {
DateFormat formatter = new SimpleDateFormat(DateFormat);
try {
Date date = (Date) formatter.parse(str);
return str.equals(formatter.format(date));
} catch (Exception e) {
return false;
}
}
//时间字符串转为某种格式的时间字符串
public static String strFormatDateStr(String DateFormat, String str) {
DateFormat formatter = new SimpleDateFormat(DateFormat);
try {
Date date = (Date) formatter.parse(str);
return formatter.format(date);
} catch (Exception e) {
return getStringDate();
}
}
public static String formatDateByPattern(String dataPattern, Date date) {
SimpleDateFormat sdf = new SimpleDateFormat(dataPattern);
return sdf.format(date);
}
/**
* 根据String型时间,获取long型时间,单位毫秒
* @return long型时间
*/
public static long fromDateStringToLong() {
Date date = null;
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss:SSS");
try {
date = inputFormat.parse(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss:SSS").format(new Date()));
} catch (Exception e) {
e.printStackTrace();
}
return date.getTime();
}
}
package cn.com.uitech.config.utils;
import org.apache.http.*;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.util.*;
/**
* @author 马弦
* @date 2017年10月23日 下午2:49
* HttpClient工具类
*/
public class HttpUtil {
/**
* get请求
*
* @return
*/
public static String doGet(String url) {
try {
HttpClient client = new DefaultHttpClient();
//发送get请求
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
/**请求发送成功,并得到响应**/
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
/**读取服务器返回过来的json字符串数据**/
String strResult = EntityUtils.toString(response.getEntity());
return strResult;
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* post请求(用于key-value格式的参数)
*
* @param url
* @param params
* @return
*/
public static String doPost(String url, Map params) {
BufferedReader in = null;
try {
// 定义HttpClient
HttpClient client = new DefaultHttpClient();
// 实例化HTTP方法
HttpPost request = new HttpPost();
request.setURI(new URI(url));
//设置参数
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
for (Iterator iter = params.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String value = String.valueOf(params.get(name));
nvps.add(new BasicNameValuePair(name, value));
//System.out.println(name +"-"+value);
}
request.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
HttpResponse response = client.execute(request);
int code = response.getStatusLine().getStatusCode();
if (code == 200) { //请求成功
in = new BufferedReader(new InputStreamReader(response.getEntity()
.getContent(), "utf-8"));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line + NL);
}
in.close();
return sb.toString();
} else { //
System.out.println("状态码:" + code);
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* post请求(用于请求json格式的参数)
*
* @param url
* @param params
* @return
*/
public static String doPost(String url, String params) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
Base64.Encoder encoder = Base64.getEncoder();
String text = "kermit:kermit";
byte[] textByte = text.getBytes("UTF-8");
//编码
String author = encoder.encodeToString(textByte);
HttpPost httpPost = new HttpPost(url);// 创建httpPost
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Accept-Language", "zh-cn");
httpPost.setHeader("Authorization", "Basic " + author);
String charSet = "UTF-8";
StringEntity entity = new StringEntity(params, charSet);
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpPost);
StatusLine status = response.getStatusLine();
int state = status.getStatusCode();
if (state == HttpStatus.SC_OK || state == HttpStatus.SC_CREATED) {
HttpEntity responseEntity = response.getEntity();
String jsonString = EntityUtils.toString(responseEntity);
return jsonString;
} else {
//logger.error("请求返回:"+state+"("+url+")");
}
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
}
\ No newline at end of file
package cn.com.uitech.config.utils;
import java.util.*;
public class StringUtil extends org.springframework.util.StringUtils {
public static boolean isNullOrEmpty(String a) {
return a == null || a.isEmpty();
}
public static boolean isNullOrWhiteSpace(String a) {
return a == null || (a.length() > 0 && a.trim().length() <= 0);
}
/**
* @作者 尧
* @功能 String左对齐
*/
public static String padRight(String src, int len, char ch) {
int diff = len - src.length();
if (diff <= 0) {
return src;
}
char[] charr = new char[len];
System.arraycopy(src.toCharArray(), 0, charr, 0, src.length());
for (int i = src.length(); i < len; i++) {
charr[i] = ch;
}
return new String(charr);
}
/**
* @作者 尧
* @功能 String右对齐
*/
public static String padLeft(String src, int len, char ch) {
int diff = len - src.length();
if (diff <= 0) {
return src;
}
char[] charr = new char[len];
System.arraycopy(src.toCharArray(), 0, charr, diff, src.length());
for (int i = 0; i < diff; i++) {
charr[i] = ch;
}
return new String(charr);
}
public static String substringAndTrim(String src, int startLength, int endLength) {
return src.substring(startLength, endLength).replaceAll("^(0+)", "");
}
/**
* 把其他对象集合转成String集合
*
* @param aryObj
* @return
*/
public static List<String> convertToStringArray(List<Integer> aryObj) {
List<String> aryRet = new ArrayList<>();
for (Integer obj : aryObj) {
aryRet.add(obj.toString());
}
return aryRet;
}
/**
* 求ls对ls2的差集,即ls中有,但ls2中没有的
*
* @param ls
* @param ls2
* @return
*/
public static List diff(List ls, List ls2) {
List list = new ArrayList(Arrays.asList(new Object[ls.size()]));
Collections.copy(list, ls);
list.removeAll(ls2);
return list;
}
/**
* 求2个集合的交集
*
* @param ls
* @param ls2
* @return
*/
public static List intersect(List ls, List ls2) {
List list = new ArrayList(Arrays.asList(new Object[ls.size()]));
Collections.copy(list, ls);
list.retainAll(ls2);
return list;
}
/**
* 求2个集合的交集
*
* @param ls
* @param ls2
* @return
*/
public static List intersect(Set<String> ls, List ls2) {
List list = new ArrayList<String>(ls);
//Collections.copy(list, ls);
list.retainAll(ls2);
return list;
}
/**
* 求2个集合的并集
*
* @param ls
* @param ls2
* @return
*/
public static List union(List ls, List ls2) {
List list = new ArrayList(Arrays.asList(new Object[ls.size()]));
Collections.copy(list, ls);//将ls的值拷贝一份到list中
list.removeAll(ls2);
list.addAll(ls2);
return list;
}
//求两个字符串数组的并集,利用set的元素唯一性
public static String[] union(String[] arr1, String[] arr2) {
Set<String> set = new HashSet<String>();
for (String str : arr1) {
set.add(str);
}
for (String str : arr2) {
set.add(str);
}
String[] result = {};
return set.toArray(result);
}
//求两个数组的交集
public static String[] intersect(String[] arr1, String[] arr2) {
Map<String, Boolean> map = new HashMap<String, Boolean>();
LinkedList<String> list = new LinkedList<String>();
for (String str : arr1) {
if (!map.containsKey(str)) {
map.put(str, Boolean.FALSE);
}
}
for (String str : arr2) {
if (map.containsKey(str)) {
map.put(str, Boolean.TRUE);
}
}
for (Map.Entry<String, Boolean> e : map.entrySet()) {
if (e.getValue().equals(Boolean.TRUE)) {
list.add(e.getKey());
}
}
String[] result = {};
return list.toArray(result);
}
//求两个数组的差集
public static String[] minus(String[] arr1, String[] arr2) {
LinkedList<String> list = new LinkedList<String>();
LinkedList<String> history = new LinkedList<String>();
String[] longerArr = arr1;
String[] shorterArr = arr2;
//找出较长的数组来减较短的数组
if (arr1.length > arr2.length) {
longerArr = arr2;
shorterArr = arr1;
}
for (String str : longerArr) {
if (!list.contains(str)) {
list.add(str);
}
}
for (String str : shorterArr) {
if (list.contains(str)) {
history.add(str);
list.remove(str);
} else {
if (!history.contains(str)) {
list.add(str);
}
}
}
String[] result = {};
return list.toArray(result);
}
/*
* byte数组转换为十六进制的字符串
* **/
private static String conver16HexStr(byte[] b) {
StringBuffer result = new StringBuffer();
for (int i = 0; i < b.length; i++) {
if ((b[i] & 0xff) < 0x10) {
result.append("0");
}
result.append(Long.toString(b[i] & 0xff, 16));
}
return result.toString().toUpperCase();
}
/**
* 十六进制的字符串转换为byte数组
**/
private static byte[] conver16HexToByte(String hex16Str) {
char[] c = hex16Str.toCharArray();
byte[] b = new byte[c.length / 2];
for (int i = 0; i < b.length; i++) {
int pos = i * 2;
b[i] = (byte) ("0123456789ABCDEF".indexOf(c[pos]) << 4 | "0123456789ABCDEF".indexOf(c[pos + 1]));
}
return b;
}
}
package cn.com.uitech.config.vo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class AttributesBeanVO {
private Integer cdbid = 0;
private int roleVisibleType = 0;
private String dataType = "0";
private String mode = "set";//view or set
}
package cn.com.uitech.config.vo;
import cn.com.uitech.config.entity.BasicDataBOM;
import cn.com.uitech.config.entity.BasicDataProperty;
import cn.com.uitech.config.entity.BasicDataPropertyValue;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class BOMCVCacheVO {
private List<BasicDataBOM> aryBOM;
private List<BasicDataProperty> aryC;
private List<BasicDataPropertyValue> aryValue;
}
package cn.com.uitech.config.vo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
public class BOMInitializeExResultVO {
private Map<Integer, Map<String, List<Integer>>> aryRS = new HashMap<>();
private Map<Integer, Map<Integer, Map<String, List<Integer>>>> aryVT = new HashMap<>();
private Map<Integer, List<Integer>> aryInvalidRow = new HashMap<>();
}
package cn.com.uitech.config.vo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
public class ConfigProcResultVO {
public Map<Integer, Map<String, List<Integer>>> aryRS;
public Map<Integer, List<Integer>> aryInvalidRowInner;
}
server:
port: 10040
spring:
redis:
host: ${REDIS_HOST:10.101.49.3}
port: ${REDIS_PORT:6379}
password: "CiEz-1309"
cto-database: 14
db-database: 15
database: 0
ssl: false
jedis:
pool:
max-active: 50
max-idle: 30
max-wait: 1000ms
jpa:
hibernate:
naming:
implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
ddl-auto: none
properties:
hibernate:
temp:
use_jdbc_metadata_defaults: false
database-platform: org.hibernate.dialect.PostgreSQLDialect
datasource:
url: jdbc:postgresql://10.101.49.3:5432/cf_crm?currentSchema=public
username: cfcrm
password: 1qaz@wsx
driverClassName: org.postgresql.Driver
hikari:
maximum-pool-size: 30
minimum-idle: 10
connection-test-query: SELECT 1
max-lifetime: 1800000
connection-timeout: 30000
idle-timeout: 30000
sleuth:
sampler:
probability: 1.0
appSettings:
dataSourceFlagList: LMS
smb:
firstCachePrefix: SMBB4A3D4E306A647E781E0EC9263A5AACC
firstSystemArray: rel-smb
dataSourceFlag: SMB
ctoPrice:
url: http://10.116.67.72:8052/cps/PriceAdapter/cto1
stdPrice:
url: http://10.116.67.72:8052/cps/PriceAdapter/std1
divisionList: 84,85,86,49 #涉及的产品组
materialStatus: 1 #物料状态,1是可卖,0是全部
cacheRefreshHour: 6 #每天几点刷新缓存,全部刷新
ats:
url: http://10.99.110.142:6102/ats/ctosupplycycle1
bindFlag: false
stock:
url: http://10.99.110.142:6102/ats/1
lms:
firstCachePrefix: B4A3D4E306A647E781E0EC9263A5AACB
firstSystemArray: rel-b2b,rel-edi,FastQuote,rel-jzh,account-configurator
dataSourceFlag: LMS
ctoPrice:
url: http://10.116.67.72:8052/cps/PriceAdapter/cto1
stdPrice:
url: http://10.116.67.72:8052/cps/PriceAdapter/std1
divisionList: 03,06,14,23,79,84,85,86,87,B5,B6,B7,B8 #涉及的产品组
materialStatus: 1 #物料状态,1是可卖,0是全部
cacheRefreshHour: 7 #每天几点刷新缓存,全部刷新
ats:
url: http://10.99.110.142:6102/ats/ctosupplycycle1
bindFlag: false
stock:
url: http://10.99.110.142:6102/ats/1
management:
health:
defaults:
enabled: false
\ No newline at end of file
server:
port: 8081
spring:
profiles:
active: cf-tst
application:
name: ${APPLICATION_NAME:uitech}--${SERVICE_NAME:system}
# 遇到相同名字时,是否允许覆盖注册
main:
allow-bean-definition-overriding: true
datasource:
driver-class-name: org.postgresql.Driver
platform: postgresql
url: jdbc:postgresql://localhost:5432/postgres?currentSchema=public
username: postgres
password: postgres
type: com.zaxxer.hikari.HikariDataSource
redis:
# Redis数据库索引(默认为0)
database: 15
cto-database: 14
host: localhost
port: 6379
password: abcd-1234
timeout: 5000
jedis:
pool:
max-active: 200
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: 5000
# 连接池中的最大空闲连接
max-idle: 8
# 连接池中的最小空闲连接
min-idle: 0
# datasource:
# driver-class-name: org.postgresql.Driver
# platform: postgresql
# url: jdbc:postgresql://localhost:5432/postgres?currentSchema=public
# username: postgres
# password: postgres
# type: com.zaxxer.hikari.HikariDataSource
# redis:
# # Redis数据库索引(默认为0)
# database: 15
# cto-database: 14
# host: localhost
# port: 6379
# password: abcd-1234
# timeout: 5000
# jedis:
# pool:
# max-active: 200
# # 连接池最大阻塞等待时间(使用负值表示没有限制)
# max-wait: 5000
# # 连接池中的最大空闲连接
# max-idle: 8
# # 连接池中的最小空闲连接
# min-idle: 0
### MyBatis ###
mybatis:
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ui-tech-system</groupId>
<artifactId>ui-tech-system</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath/>
</parent>
<!-- 依赖版本控制 -->
<properties>
<java.version>1.8</java.version>
<web.version>2.2.5.RELEASE</web.version>
<security.version>2.1.0.RELEASE</security.version>
<redis.version>2.2.5.RELEASE</redis.version>
<mybatis-mapper.version>2.1.5</mybatis-mapper.version>
<fastjson.version>1.2.73</fastjson.version>
<swagger.version>2.9.2</swagger.version>
<mybatis.version>2.1.4</mybatis.version>
<retrofit.version>2.0.2</retrofit.version>
<feign.version>2.2.5.RELEASE</feign.version>
<codec.version>1.8</codec.version>
<feign.httpVersion>10.1.0</feign.httpVersion>
<collections.version>3.2.2</collections.version>
<security-oauth2-autoconfigure.version>2.1.0.RELEASE</security-oauth2-autoconfigure.version>
</properties>
<dependencies>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.2</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.fasterxml.jackson.core</groupId>-->
<!-- <artifactId>jackson-databind</artifactId>-->
<!-- <version>2.10.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.5</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-base</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-core</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>${mybatis-mapper.version}</version>
</dependency>
<!-- Swagger API文档 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.20</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.deepoove</groupId>
<artifactId>poi-tl</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!-- <version>3.4.6</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!-- </dependency>-->
<!-- Swagger API文档 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.73</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>tk.mybatis</groupId>-->
<!-- <artifactId>mapper-spring-boot-autoconfigure</artifactId>-->
<!-- <version>2.1.5</version>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>cn.com.uitech.AuthServerApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ 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