Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
config-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
何熠
config-server-api
Commits
c4d2be67
Commit
c4d2be67
authored
Jan 06, 2022
by
zhaoxiaolei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传下载
parent
f9467261
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1767 additions
and
196 deletions
+1767
-196
CharacteristicController.java
...ch/authorization/controller/CharacteristicController.java
+25
-1
CharacteristicValueController.java
...thorization/controller/CharacteristicValueController.java
+3
-3
SuperBomPriceCalculateController.java
...rization/controller/SuperBomPriceCalculateController.java
+29
-5
CharacteristicMapper.java
...com/uitech/authorization/mapper/CharacteristicMapper.java
+5
-0
CharacteristicValueMapper.java
...itech/authorization/mapper/CharacteristicValueMapper.java
+2
-0
SuperBomPriceCalculateMapper.java
...ch/authorization/mapper/SuperBomPriceCalculateMapper.java
+6
-0
TempMapper.java
...n/java/cn/com/uitech/authorization/mapper/TempMapper.java
+5
-0
CharacteristicExportDto.java
...itech/authorization/pojo/dto/CharacteristicExportDto.java
+50
-0
CharacteristicRequestParamDto.java
...authorization/pojo/dto/CharacteristicRequestParamDto.java
+2
-6
CharacteristicValueExportDto.java
.../authorization/pojo/dto/CharacteristicValueExportDto.java
+51
-40
SuperCharacterPriceInfoDto.java
...ch/authorization/pojo/dto/SuperCharacterPriceInfoDto.java
+42
-0
Characteristics.java
...com/uitech/authorization/pojo/entity/Characteristics.java
+1
-0
SuperCharacterPriceInfoEntity.java
...horization/pojo/entity/SuperCharacterPriceInfoEntity.java
+5
-1
UserInfo.java
...ava/cn/com/uitech/authorization/pojo/entity/UserInfo.java
+1
-1
CharacteristicService.java
...m/uitech/authorization/service/CharacteristicService.java
+5
-0
SuperBomPriceCalculateService.java
.../authorization/service/SuperBomPriceCalculateService.java
+8
-0
CharacteristicServiceImpl.java
...authorization/service/impl/CharacteristicServiceImpl.java
+357
-2
CharacteristicValueServiceImpl.java
...rization/service/impl/CharacteristicValueServiceImpl.java
+252
-81
IntegrateServiceImpl.java
...tech/authorization/service/impl/IntegrateServiceImpl.java
+9
-8
SuperBomPriceCalculateServiceImpl.java
...ation/service/impl/SuperBomPriceCalculateServiceImpl.java
+504
-1
TempServiceImpl.java
...om/uitech/authorization/service/impl/TempServiceImpl.java
+6
-2
DateUitl.java
...main/java/cn/com/uitech/authorization/utils/DateUitl.java
+243
-0
ProductExportUtils.java
...cn/com/uitech/authorization/utils/ProductExportUtils.java
+13
-5
CharacteristicMapper.xml
src/main/resources/mapper/CharacteristicMapper.xml
+36
-0
CharacteristicValueMapper.xml
src/main/resources/mapper/CharacteristicValueMapper.xml
+31
-35
SuperBomPriceCalculateMapper.xml
src/main/resources/mapper/SuperBomPriceCalculateMapper.xml
+66
-0
TempMapper.xml
src/main/resources/mapper/TempMapper.xml
+8
-3
UserInfoMapper.xml
src/main/resources/mapper/UserInfoMapper.xml
+2
-2
No files found.
src/main/java/cn/com/uitech/authorization/controller/CharacteristicController.java
View file @
c4d2be67
...
...
@@ -19,8 +19,10 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
...
...
@@ -30,7 +32,7 @@ import java.util.List;
@RestController
@RequestMapping
(
"/characteristic"
)
@Api
(
tags
=
{
"Characteristic 特征管理"
})
@ApiIgnore
//
@ApiIgnore
public
class
CharacteristicController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CharacteristicController
.
class
);
...
...
@@ -107,4 +109,26 @@ public class CharacteristicController {
}
/**
* @desc 特征管理 导出特征
* @param dto
* @param response
*/
@PostMapping
(
"/exportCharacteristic"
)
@ApiOperation
(
value
=
"特征管理 导出特征"
,
notes
=
"特征管理 导出特征"
,
httpMethod
=
"POST"
)
public
void
exportCharacteristic
(
@RequestBody
CharacteristicRequestParamDto
dto
,
HttpServletResponse
response
){
characteristicService
.
exportCharacteristic
(
dto
,
response
);
}
/**
* @desc 特征管理 上传文件更新
* @param file
* @return
*/
@RequestMapping
(
"/batchUpdateByUpload"
)
@ApiOperation
(
value
=
"特征管理 上传文件更新"
,
notes
=
"特征管理 上传文件更新"
,
httpMethod
=
"POST"
)
public
CrmResponseEntity
<?>
batchUpdateByUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
){
return
ResultGenerator
.
genSuccessResult
(
characteristicService
.
batchUpdateByUpload
(
file
));
}
}
src/main/java/cn/com/uitech/authorization/controller/CharacteristicValueController.java
View file @
c4d2be67
...
...
@@ -34,7 +34,7 @@ import java.util.List;
@RestController
@RequestMapping
(
"/characteristicValue"
)
@Api
(
tags
=
{
"CharacteristicValue 特征值管理"
})
@ApiIgnore
//
@ApiIgnore
public
class
CharacteristicValueController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CharacteristicValueController
.
class
);
...
...
@@ -103,8 +103,8 @@ public class CharacteristicValueController {
* @param dto
* @param response
*/
@
Reque
stMapping
(
"/exportCharacteristicValue"
)
@ApiOperation
(
value
=
"特征值管理 导出特征值"
,
notes
=
"特征值管理 导出特征值"
,
httpMethod
=
"
POS
T"
)
@
Po
stMapping
(
"/exportCharacteristicValue"
)
@ApiOperation
(
value
=
"特征值管理 导出特征值"
,
notes
=
"特征值管理 导出特征值"
,
httpMethod
=
"
GPOSTE
T"
)
public
void
exportCharacteristicValue
(
@RequestBody
CharacteristicValueRequestParamDto
dto
,
HttpServletResponse
response
){
characteristicValueService
.
exportCharacteristicValue
(
dto
,
response
);
}
...
...
src/main/java/cn/com/uitech/authorization/controller/SuperBomPriceCalculateController.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
controller
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto
;
import
cn.com.uitech.authorization.pojo.entity.*
;
import
cn.com.uitech.authorization.service.SuperBomPriceCalculateService
;
import
cn.com.uitech.authorization.utils.CrmResponseEntity
;
...
...
@@ -7,13 +9,12 @@ import cn.com.uitech.authorization.utils.ResultGenerator;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
/**
...
...
@@ -26,7 +27,7 @@ import java.util.Map;
@RestController
@RequestMapping
(
"/superBom"
)
@Api
(
tags
=
{
"部件产品价格系数维护"
})
@ApiIgnore
//
@ApiIgnore
public
class
SuperBomPriceCalculateController
{
@Resource
...
...
@@ -68,4 +69,27 @@ public class SuperBomPriceCalculateController {
public
CrmResponseEntity
<
Object
>
getPriceByConfigInfo
(
@RequestBody
SuperBomEntity
superBomEntity
)
{
return
ResultGenerator
.
genSuccessResult
(
superBomPriceCalculateService
.
getPriceByConfigInfo
(
superBomEntity
));
}
/**
* @desc 特征值价格管理 导出特征值价格
* @param dto
* @param response
*/
@PostMapping
(
"/exportCharacteristicValuePrice"
)
@ApiOperation
(
value
=
"特征值价格管理 导出特征值价格"
,
notes
=
"特征值价格管理 导出特征值价格"
,
httpMethod
=
"POST"
)
public
void
exportCharacteristicValuePrice
(
@RequestBody
CharacteristicValueExportDto
dto
,
HttpServletResponse
response
){
superBomPriceCalculateService
.
exportCharacteristicValuePrice
(
dto
,
response
);
}
/**
* @desc 特征值价格管理 上传文件更新
* @param file
* @return
*/
@RequestMapping
(
"/batchUpdateByUpload"
)
@ApiOperation
(
value
=
"特征值价格管理 上传文件更新"
,
notes
=
"特征值价格管理 上传文件更新"
,
httpMethod
=
"POST"
)
public
CrmResponseEntity
<?>
batchUpdateByUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
){
return
ResultGenerator
.
genSuccessResult
(
superBomPriceCalculateService
.
batchUpdateByUpload
(
file
));
}
}
src/main/java/cn/com/uitech/authorization/mapper/CharacteristicMapper.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
mapper
;
import
cn.com.uitech.authorization.pojo.dto.ApplySkuCodeResultDto
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicExportDto
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto
;
import
cn.com.uitech.authorization.pojo.entity.*
;
import
io.swagger.models.auth.In
;
...
...
@@ -93,4 +94,8 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
List
<
Characteristic
>
getCharacteristicH3CList
(
String
superBomCode
);
Integer
getCharacteristicInfo
(
String
characteristicCode
,
String
superBomCode
);
List
<
CharacteristicExportDto
>
exportCharacteristic
(
CharacteristicRequestParamDto
dto
);
void
updateCharacteristicInfo
(
Characteristic
info
);
}
src/main/java/cn/com/uitech/authorization/mapper/CharacteristicValueMapper.java
View file @
c4d2be67
...
...
@@ -107,4 +107,6 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
void
saveDeployPlm
(
SendDataToPlmLog
log
);
CharacteristicValue
getCharacteristicValueInfoByCCode
(
String
isH3cCode
,
String
superBomCode
);
void
updateCharacteristicValue
(
CharacteristicValue
v
);
}
src/main/java/cn/com/uitech/authorization/mapper/SuperBomPriceCalculateMapper.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
mapper
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto
;
import
cn.com.uitech.authorization.pojo.dto.SuperCharacterPriceInfoDto
;
import
cn.com.uitech.authorization.pojo.entity.*
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -46,4 +48,8 @@ public interface SuperBomPriceCalculateMapper {
List
<
SuperCharacterPriceInfoEntity
>
getCharacterValueList
(
CharacteristicValue
characteristicValue
);
SuperBomPriceInfoEntity
getCharacteristicsPrice
(
String
superBomCode
,
Integer
type
);
List
<
SuperCharacterPriceInfoDto
>
exportCharacteristicValuePrice
(
CharacteristicValueExportDto
dto
);
void
updateCharacteristicInfo
(
Characteristics
info
);
}
src/main/java/cn/com/uitech/authorization/mapper/TempMapper.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
mapper
;
import
cn.com.uitech.authorization.pojo.dto.DeployTempItemParam
;
import
cn.com.uitech.authorization.pojo.dto.DeployTempParam
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
@Mapper
public
interface
TempMapper
{
DeployTempParam
getTempList
();
void
updateTemp
(
DeployTempParam
deployTempParam
);
List
<
DeployTempItemParam
>
getTempListBySkuCode
(
String
oldSkuCode
);
}
src/main/java/cn/com/uitech/authorization/pojo/dto/CharacteristicExportDto.java
0 → 100644
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
pojo
.
dto
;
import
cn.com.uitech.authorization.annotation.FieldNameMapping
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
@Accessors
(
chain
=
true
)
@NoArgsConstructor
@Getter
@Setter
@ToString
public
class
CharacteristicExportDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
587176618049116478L
;
/**
* 排序
*/
@FieldNameMapping
(
name
=
"sort"
,
value
=
"排序"
)
private
String
sort
;
/**
* SuperBOM
*/
@FieldNameMapping
(
name
=
"superBomCode"
,
value
=
"SuperBOM"
)
private
String
superBomCode
;
/**
* 特征编码
*/
@FieldNameMapping
(
name
=
"characteristicCode"
,
value
=
"特征编码"
)
private
String
characteristicCode
;
/**
* PLM名称
*/
@FieldNameMapping
(
name
=
"characteristicName"
,
value
=
"PLM名称"
)
private
String
characteristicName
;
/**
* 销售名称
*/
@FieldNameMapping
(
name
=
"unisSalesCName"
,
value
=
"销售名称"
)
private
String
unisSalesCName
;
/**
* IsH3C
*/
@FieldNameMapping
(
name
=
"isH3C"
,
value
=
"IsH3C"
)
private
String
isH3C
;
}
src/main/java/cn/com/uitech/authorization/pojo/dto/CharacteristicRequestParamDto.java
View file @
c4d2be67
...
...
@@ -4,10 +4,7 @@ import cn.com.uitech.authorization.annotation.BathUpdate;
import
cn.com.uitech.authorization.annotation.EditSave
;
import
cn.com.uitech.authorization.annotation.Query
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
org.springframework.stereotype.Component
;
...
...
@@ -23,8 +20,7 @@ import java.io.Serializable;
*/
@Accessors
(
chain
=
true
)
@NoArgsConstructor
@Getter
@Setter
@Data
@ToString
public
class
CharacteristicRequestParamDto
extends
BasePageDto
implements
Serializable
{
...
...
src/main/java/cn/com/uitech/authorization/pojo/dto/CharacteristicValueExportDto.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
pojo
.
dto
;
import
cn.com.uitech.authorization.annotation.FieldNameMapping
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
org.springframework.stereotype.Component
;
import
java.io.Serializable
;
/**
* @author yangkuo
* @date 2020/6/18 14:37
* @desc 特征值导出实体体
*/
@Accessors
(
chain
=
true
)
@NoArgsConstructor
@Getter
@Setter
@Data
@ToString
public
class
CharacteristicValueExportDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
587176618049116478L
;
private
String
brand
;
private
String
productClassCode
;
/**
* SuperBOM
*/
@FieldNameMapping
(
name
=
"superBomCode"
,
value
=
"SuperBOM"
)
private
String
superBomCode
;
/**
*
cto 机型名称
*
特征编码
*/
@FieldNameMapping
(
name
=
"superBomName"
,
value
=
"CTO机型名称"
)
private
String
superBomName
;
@FieldNameMapping
(
name
=
"CharacteristicCode"
,
value
=
"特征编码"
)
private
String
characteristicCode
;
/**
* 特征名称
*/
@FieldNameMapping
(
name
=
"CharacteristicName"
,
value
=
"特征名称"
)
private
String
characteristicName
;
/**
* 特征值编码
*/
@FieldNameMapping
(
name
=
"
characteristicValueCode"
,
value
=
"特征值编码(请勿修改)
"
)
@FieldNameMapping
(
name
=
"
CharacteristicValueCode"
,
value
=
"特征值编码
"
)
private
String
characteristicValueCode
;
/**
*
特征值
名称
*
PLM
名称
*/
@FieldNameMapping
(
name
=
"
characteristicValueName"
,
value
=
"特征值
名称"
)
@FieldNameMapping
(
name
=
"
CharacteristicValueName"
,
value
=
"PLM
名称"
)
private
String
characteristicValueName
;
/**
* 特征名称
*/
@FieldNameMapping
(
name
=
"characteristicName"
,
value
=
"特征名称"
)
private
String
characteristicName
;
/**
* cto 物料编号
* 销售名称
*/
@FieldNameMapping
(
name
=
"
superBomCode"
,
value
=
"产品BOM
"
)
private
String
superBomCod
e
;
@FieldNameMapping
(
name
=
"
unisSalesVName"
,
value
=
"销售名称
"
)
private
String
unisSalesVNam
e
;
/**
*
特征值
是否可卖
* 是否可卖
*/
@FieldNameMapping
(
name
=
"isState"
,
value
=
"可卖状态
"
)
@FieldNameMapping
(
name
=
"isState"
,
value
=
"是否可卖
"
)
private
String
isState
;
/**
*
是否可见
*
ZPHCode
*/
@FieldNameMapping
(
name
=
"isShow"
,
value
=
"可见状态"
)
private
String
isShow
;
@FieldNameMapping
(
name
=
"zphCode"
,
value
=
"ZPHCode"
)
private
String
zphCode
;
/**
*
cto 是否可卖
*
ZPHName
*/
@FieldNameMapping
(
name
=
"
bomStatus"
,
value
=
"CTO机型可卖
"
)
private
String
bomStatus
;
@FieldNameMapping
(
name
=
"
zphName"
,
value
=
"ZPHName
"
)
private
String
zphName
;
/**
*
产品组
*
开始时间
*/
@FieldNameMapping
(
name
=
"productClassCode"
,
value
=
"产品组"
)
private
String
productClassCode
;
@FieldNameMapping
(
name
=
"qualifyDate"
,
value
=
"开始时间"
)
private
String
qualifyDate
;
/**
*
产品组
*
H3C对照关系
*/
@FieldNameMapping
(
name
=
"productClassName"
,
value
=
"产品组"
)
private
String
productClassName
;
@FieldNameMapping
(
name
=
"h3cCValue"
,
value
=
"H3C对照关系"
)
private
String
h3cCValue
;
private
String
h3cDeliverCode
;
}
src/main/java/cn/com/uitech/authorization/pojo/dto/SuperCharacterPriceInfoDto.java
0 → 100644
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
pojo
.
dto
;
import
cn.com.uitech.authorization.annotation.FieldNameMapping
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.sql.Date
;
@Data
public
class
SuperCharacterPriceInfoDto
{
private
String
cvPriceId
;
@FieldNameMapping
(
name
=
"superBomCode"
,
value
=
"SuperBOM"
)
private
String
superBomCode
;
@FieldNameMapping
(
name
=
"superBomName"
,
value
=
"SuperBOM名称"
)
private
String
superBomName
;
@FieldNameMapping
(
name
=
"priceType"
,
value
=
"定价类型"
)
private
String
priceType
;
@FieldNameMapping
(
name
=
"characterCode"
,
value
=
"特征编号"
)
private
String
characterCode
;
@FieldNameMapping
(
name
=
"characterName"
,
value
=
"特征名称"
)
private
String
characterName
;
@FieldNameMapping
(
name
=
"characterValueCode"
,
value
=
"特征值编号"
)
private
String
characterValueCode
;
@FieldNameMapping
(
name
=
"characterValueName"
,
value
=
"特征值名称"
)
private
String
characterValueName
;
@FieldNameMapping
(
name
=
"actualPrice"
,
value
=
"真实成本"
)
private
String
actualPrice
;
@FieldNameMapping
(
name
=
"leve0Price"
,
value
=
"标准成本"
)
private
String
leve0Price
;
@FieldNameMapping
(
name
=
"leve1Price"
,
value
=
"一级调整价"
)
private
String
leve1Price
;
@FieldNameMapping
(
name
=
"leve2Price"
,
value
=
"二级调整价"
)
private
String
leve2Price
;
@FieldNameMapping
(
name
=
"leve3Price"
,
value
=
"三级调整价"
)
private
String
leve3Price
;
@FieldNameMapping
(
name
=
"leve4Price"
,
value
=
"四级调整价"
)
private
String
leve4Price
;
@FieldNameMapping
(
name
=
"agentPrice"
,
value
=
"代理价"
)
private
String
agentPrice
;
}
src/main/java/cn/com/uitech/authorization/pojo/entity/Characteristics.java
View file @
c4d2be67
...
...
@@ -24,6 +24,7 @@ public class Characteristics {
private
String
unisSalesVName
;
private
String
h3cCValue
;
private
String
h3cCName
;
private
String
superBomCode
;
/**
* 真实成本价
*/
...
...
src/main/java/cn/com/uitech/authorization/pojo/entity/SuperCharacterPriceInfoEntity.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
pojo
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
java.sql.Date
;
import
java.sql.Timestamp
;
import
java.util.Objects
;
/**
...
...
@@ -32,5 +34,7 @@ public class SuperCharacterPriceInfoEntity {
private
BigDecimal
leve4Price
;
private
BigDecimal
agentPrice
;
private
String
updateUser
;
private
Date
updateTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Timestamp
updateTime
;
}
src/main/java/cn/com/uitech/authorization/pojo/entity/UserInfo.java
View file @
c4d2be67
...
...
@@ -21,7 +21,7 @@ public class UserInfo {
@Column
(
name
=
"user_code"
)
private
String
userCode
;
@Column
(
name
=
"pass_word"
)
private
String
pass
W
ord
;
private
String
pass
w
ord
;
@Column
(
name
=
"user_name"
)
private
String
userName
;
@Column
(
name
=
"user_dimension"
)
...
...
src/main/java/cn/com/uitech/authorization/service/CharacteristicService.java
View file @
c4d2be67
...
...
@@ -5,7 +5,9 @@ import cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto
;
import
cn.com.uitech.authorization.pojo.entity.Characteristic
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
...
...
@@ -55,4 +57,7 @@ public interface CharacteristicService {
Object
updateCharacteristicIsH3C
(
CharacteristicRequestParamDto
dto
);
void
exportCharacteristic
(
CharacteristicRequestParamDto
dto
,
HttpServletResponse
response
);
Object
batchUpdateByUpload
(
MultipartFile
file
);
}
src/main/java/cn/com/uitech/authorization/service/SuperBomPriceCalculateService.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
service
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto
;
import
cn.com.uitech.authorization.pojo.entity.*
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @Author: ZXN
...
...
@@ -32,4 +36,8 @@ public interface SuperBomPriceCalculateService {
* @return
*/
PageInfo
<
SuperCharacterPriceInfoEntity
>
getCharacterValueList
(
CharacteristicValue
characteristicValue
);
void
exportCharacteristicValuePrice
(
CharacteristicValueExportDto
dto
,
HttpServletResponse
response
);
Object
batchUpdateByUpload
(
MultipartFile
file
);
}
src/main/java/cn/com/uitech/authorization/service/impl/CharacteristicServiceImpl.java
View file @
c4d2be67
...
...
@@ -2,23 +2,36 @@ package cn.com.uitech.authorization.service.impl;
import
cn.com.uitech.authorization.exception.BizException
;
import
cn.com.uitech.authorization.mapper.CharacteristicMapper
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicExportDto
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto
;
import
cn.com.uitech.authorization.pojo.entity.Characteristic
;
import
cn.com.uitech.authorization.service.CharacteristicService
;
import
cn.com.uitech.authorization.service.CtoBomService
;
import
cn.com.uitech.authorization.utils.ApiResult
;
import
cn.com.uitech.authorization.utils.DateUitl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.openxml4j.util.ZipSecureFile
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
tk.mybatis.mapper.entity.Condition
;
import
tk.mybatis.mapper.entity.Example
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Objects
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.nio.charset.StandardCharsets
;
import
java.text.DecimalFormat
;
import
java.util.*
;
/**
* @author yangkuo
...
...
@@ -116,4 +129,346 @@ public class CharacteristicServiceImpl implements CharacteristicService {
public
Object
updateCharacteristicIsH3C
(
CharacteristicRequestParamDto
dto
)
{
return
characteristicMapper
.
updateCharacteristicIsH3C
(
dto
);
}
@Override
public
void
exportCharacteristic
(
CharacteristicRequestParamDto
dto
,
HttpServletResponse
response
)
{
//根据页面输入框查询要导出的数据
try
{
Date
date
=
DateUitl
.
getNowAll
();
String
format
=
DateUitl
.
format
(
date
,
"yyyy-MM-dd"
);
String
[]
split
=
format
.
split
(
"-"
);
StringBuilder
worktableTitle
=
new
StringBuilder
();
for
(
String
string
:
split
)
{
worktableTitle
.
append
(
string
);
}
String
file
=
""
;
List
<
CharacteristicExportDto
>
priceModelList
=
new
ArrayList
<>();
List
<
CharacteristicExportDto
>
excelDtos
=
new
ArrayList
<>();
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
file
=
dto
.
getSuperBomCode
()
+
worktableTitle
+
".xls"
;
//根据页面输入框查询要导出的数据
priceModelList
=
characteristicMapper
.
exportCharacteristic
(
dto
);
excelDtos
=
exportStandBom
(
priceModelList
);
wb
=
exportExcelBom
(
excelDtos
);
String
filename
=
null
;
filename
=
new
String
(
file
.
getBytes
(
"GBK"
),
StandardCharsets
.
ISO_8859_1
);
response
.
setContentType
(
"APPLICATION/OCTET-STREAM"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=\""
+
filename
+
"\""
);
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
wb
.
write
(
outputStream
);
outputStream
.
close
();
}
catch
(
Exception
e
)
{
throw
new
BizException
(
ApiResult
.
INTERNAL_SERVER_ERROR
,
e
.
getMessage
());
}
}
private
List
<
CharacteristicExportDto
>
exportStandBom
(
List
<
CharacteristicExportDto
>
priceModelList
)
{
List
<
CharacteristicExportDto
>
excelDtos
=
new
ArrayList
<>();
for
(
CharacteristicExportDto
priceInfoDto
:
priceModelList
)
{
CharacteristicExportDto
dto
=
new
CharacteristicExportDto
();
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getSort
()))
{
dto
.
setSort
(
priceInfoDto
.
getSort
());
}
else
{
dto
.
setSort
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getSuperBomCode
()))
{
dto
.
setSuperBomCode
(
priceInfoDto
.
getSuperBomCode
());
}
else
{
dto
.
setSuperBomCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacteristicCode
()))
{
dto
.
setCharacteristicCode
(
priceInfoDto
.
getCharacteristicCode
());
}
else
{
dto
.
setCharacteristicCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacteristicName
()))
{
dto
.
setCharacteristicName
(
priceInfoDto
.
getCharacteristicName
());
}
else
{
dto
.
setCharacteristicName
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getUnisSalesCName
()))
{
dto
.
setUnisSalesCName
(
priceInfoDto
.
getUnisSalesCName
());
}
else
{
dto
.
setUnisSalesCName
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getIsH3C
()))
{
dto
.
setIsH3C
(
priceInfoDto
.
getIsH3C
());
}
else
{
dto
.
setIsH3C
(
null
);
}
excelDtos
.
add
(
dto
);
}
return
excelDtos
;
}
private
HSSFWorkbook
exportExcelBom
(
List
<
CharacteristicExportDto
>
excelDtos
)
{
String
[]
excelHeader
=
new
String
[]{
"排序"
,
"SuperBOM"
,
"特征编码"
,
"PLM名称"
,
"销售名称"
,
"IsH3C"
};
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
HSSFSheet
sheet
=
workbook
.
createSheet
();
// 产生表格标题行
HSSFRow
titleRow
=
sheet
.
createRow
(
1
);
// 定义所需列数
int
columnNum
=
excelHeader
.
length
;
HSSFRow
rowRowName
=
sheet
.
createRow
(
0
);
// 在索引2的位置创建行(最顶端的行开始的第二行)
// 将列头设置到sheet的单元格中
for
(
int
n
=
0
;
n
<
columnNum
;
n
++)
{
CellStyle
style
=
workbook
.
createCellStyle
();
HSSFCell
cellRowName
=
rowRowName
.
createCell
(
n
);
// 创建列头对应个数的单元格
cellRowName
.
setCellType
(
HSSFCell
.
CELL_TYPE_STRING
);
cellRowName
.
setCellValue
(
excelHeader
[
n
]);
// 设置列头单元格的值
style
.
setFillPattern
(
CellStyle
.
SOLID_FOREGROUND
);
style
.
setFillForegroundColor
(
IndexedColors
.
WHITE
.
getIndex
());
cellRowName
.
setCellStyle
(
style
);
// 设置列头单元格样式
}
// 添加表内容
for
(
int
i
=
0
;
i
<
excelDtos
.
size
();
i
++)
{
HSSFRow
ContentRow
=
sheet
.
createRow
(
i
+
1
);
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getSort
()))
{
ContentRow
.
createCell
(
0
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
0
).
setCellValue
(
excelDtos
.
get
(
i
).
getSort
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getSuperBomCode
()))
{
ContentRow
.
createCell
(
1
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
1
).
setCellValue
(
excelDtos
.
get
(
i
).
getSuperBomCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacteristicCode
()))
{
ContentRow
.
createCell
(
2
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
2
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacteristicCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacteristicName
()))
{
ContentRow
.
createCell
(
3
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
3
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacteristicName
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getUnisSalesCName
()))
{
ContentRow
.
createCell
(
4
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
4
).
setCellValue
(
excelDtos
.
get
(
i
).
getUnisSalesCName
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getIsH3C
()))
{
ContentRow
.
createCell
(
5
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
5
).
setCellValue
(
excelDtos
.
get
(
i
).
getIsH3C
());
}
}
// 让列宽随着导出的列长自动适应
for
(
int
colNum
=
0
;
colNum
<
columnNum
;
colNum
++)
{
int
columnWidth
=
sheet
.
getColumnWidth
(
colNum
)
/
256
;
for
(
int
rowNum
=
0
;
rowNum
<
sheet
.
getLastRowNum
();
rowNum
++)
{
HSSFRow
currentRow
;
// 当前行未被使用过
if
(
sheet
.
getRow
(
rowNum
)
==
null
)
{
currentRow
=
sheet
.
createRow
(
rowNum
);
}
else
{
currentRow
=
sheet
.
getRow
(
rowNum
);
}
if
(
currentRow
.
getCell
(
colNum
)
!=
null
)
{
HSSFCell
currentCell
=
currentRow
.
getCell
(
colNum
);
if
(
currentCell
.
getCellType
()
==
HSSFCell
.
CELL_TYPE_STRING
)
{
int
length
=
currentCell
.
getStringCellValue
().
getBytes
().
length
;
if
(
columnWidth
<
length
)
{
columnWidth
=
length
;
}
}
}
}
if
(
colNum
==
0
)
{
sheet
.
setColumnWidth
(
colNum
,
(
columnWidth
-
2
)
*
256
);
}
else
{
sheet
.
setColumnWidth
(
colNum
,
(
columnWidth
+
4
)
*
256
);
}
}
return
workbook
;
}
/**
* @param file
* @return
* @desc 特征管理 上传文件更新
*/
@Override
public
String
batchUpdateByUpload
(
MultipartFile
file
)
{
int
result
=
0
;
//判断文件是否为空
if
(
null
==
file
||
file
.
isEmpty
())
{
throw
new
BizException
(
ApiResult
.
API_REQ_DATA_IS_FAIL
,
"特征上传文件批量更新-上传文件为空"
);
}
//读取文件内容
List
<
CharacteristicExportDto
>
list
=
uploadExcl
(
file
);
//非空校验
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
ArrayList
<
String
>
checkFileIsNull
=
checkFileIsNull
(
list
);
if
(!
CollectionUtils
.
isEmpty
(
checkFileIsNull
))
{
return
String
.
valueOf
(
checkFileIsNull
);
}
}
else
{
}
updateData
(
list
);
return
"更新附件内容成功"
;
}
/**
* @param list
* @根据特征编码和superBom更新特征表
*/
public
void
updateData
(
List
<
CharacteristicExportDto
>
list
)
{
//更新数据库里数据
ArrayList
<
Characteristic
>
updateList
=
new
ArrayList
<>();
list
.
stream
().
forEach
((
dto
)
->
{
Characteristic
c
=
new
Characteristic
();
c
.
setCharacteristicCode
(
dto
.
getCharacteristicCode
());
c
.
setSuperBomCode
(
dto
.
getSuperBomCode
());
String
isState
=
dto
.
getIsH3C
();
if
(
isState
.
equals
(
"是"
))
{
c
.
setIsH3C
(
1
);
}
else
{
c
.
setIsH3C
(
0
);
}
c
.
setUnisSalesCName
(
dto
.
getUnisSalesCName
());
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getSort
())){
c
.
setSort
(
Integer
.
valueOf
(
dto
.
getSort
()));
}
updateList
.
add
(
c
);
});
for
(
Characteristic
info
:
updateList
)
{
characteristicMapper
.
updateCharacteristicInfo
(
info
);
}
}
/**
* @param list
* @return
* @desc 对上传的数据做非空校验
*/
public
ArrayList
<
String
>
checkFileIsNull
(
List
<
CharacteristicExportDto
>
list
)
{
ArrayList
<
String
>
checkList
=
new
ArrayList
<>();
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
CharacteristicExportDto
item
=
list
.
get
(
i
);
if
(
StringUtils
.
isBlank
(
item
.
getSuperBomCode
()))
{
sb
.
append
(
"SuperBom编号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
item
.
getCharacteristicCode
()))
{
sb
.
append
(
"特征编号不能为空"
);
}
if
(
StringUtils
.
isNotBlank
(
sb
.
toString
()))
{
sb
.
insert
(
0
,
"上传文件的第"
+
i
+
"行数据:"
);
checkList
.
add
(
sb
.
toString
());
}
}
return
checkList
;
}
/**
* @param file
* @return List<CharacteristicExportDto>
* @desc 解析上传文件
*/
public
List
<
CharacteristicExportDto
>
uploadExcl
(
MultipartFile
file
)
{
long
startDate
=
Calendar
.
getInstance
().
getTimeInMillis
();
List
<
CharacteristicExportDto
>
list
=
Lists
.
newArrayList
();
Workbook
wook
=
null
;
try
{
String
filename
=
file
.
getOriginalFilename
();
if
(
filename
.
endsWith
(
"xls"
))
{
ZipSecureFile
.
setMinInflateRatio
(-
1.0d
);
wook
=
new
HSSFWorkbook
(
file
.
getInputStream
());
}
else
if
(
filename
.
endsWith
(
"xlsx"
))
{
ZipSecureFile
.
setMinInflateRatio
(-
1.0d
);
wook
=
new
XSSFWorkbook
(
file
.
getInputStream
());
}
int
numberOfSheets
=
wook
.
getNumberOfSheets
();
for
(
int
i
=
0
;
i
<
numberOfSheets
;
i
++)
{
Sheet
sheetAt
=
wook
.
getSheetAt
(
i
);
int
rows
=
sheetAt
.
getPhysicalNumberOfRows
();
for
(
int
j
=
1
;
j
<
rows
;
j
++)
{
Row
row
=
sheetAt
.
getRow
(
j
);
int
cells
=
row
.
getPhysicalNumberOfCells
();
//把每条数据封装进对象里
CharacteristicExportDto
dto
=
setCharacteristicExportDto
(
row
,
cells
);
list
.
add
(
dto
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
long
endDate
=
Calendar
.
getInstance
().
getTimeInMillis
();
return
list
;
}
/**
* @param row
* @param cells
* @return CharacteristicValueExportDto
* @desc 把excel每行数据返回一个对象
*/
public
CharacteristicExportDto
setCharacteristicExportDto
(
Row
row
,
int
cells
)
{
CharacteristicExportDto
dto
=
new
CharacteristicExportDto
();
try
{
for
(
int
i
=
0
;
i
<
cells
;
i
++)
{
//读取到内存的只保留有更新逻辑的字段
dto
.
setSort
(
getCellValueByCell
(
row
.
getCell
(
0
)));
dto
.
setSuperBomCode
(
getCellValueByCell
(
row
.
getCell
(
1
)));
dto
.
setCharacteristicCode
(
getCellValueByCell
(
row
.
getCell
(
2
)));
dto
.
setCharacteristicName
(
getCellValueByCell
(
row
.
getCell
(
3
)));
dto
.
setUnisSalesCName
(
getCellValueByCell
(
row
.
getCell
(
4
)));
dto
.
setIsH3C
(
getCellValueByCell
(
row
.
getCell
(
5
)));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
dto
;
}
/**
* @param cell
* @return
* @desc 获取单元格各类型值,返回字符串类型
*/
private
String
getCellValueByCell
(
Cell
cell
)
{
//判断是否为null或空串
if
(
cell
==
null
||
cell
.
toString
().
trim
().
equals
(
""
))
{
return
""
;
}
String
cellValue
=
""
;
int
cellType
=
cell
.
getCellType
();
switch
(
cellType
)
{
case
Cell
.
CELL_TYPE_STRING
:
//字符串类型
cellValue
=
cell
.
getStringCellValue
().
trim
();
break
;
case
Cell
.
CELL_TYPE_BOOLEAN
:
//布尔类型
cellValue
=
String
.
valueOf
(
cell
.
getBooleanCellValue
());
break
;
case
Cell
.
CELL_TYPE_NUMERIC
:
//数值类型
if
(
HSSFDateUtil
.
isCellDateFormatted
(
cell
))
{
//判断日期类型
cellValue
=
DateFormatUtils
.
format
(
cell
.
getDateCellValue
(),
"yyyy-MM-dd"
);
}
else
{
//否
cellValue
=
new
DecimalFormat
(
"#.######"
).
format
(
cell
.
getNumericCellValue
());
}
break
;
default
:
//其它类型,取空串吧
cellValue
=
""
;
break
;
}
return
cellValue
;
}
}
src/main/java/cn/com/uitech/authorization/service/impl/CharacteristicValueServiceImpl.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
service
.
impl
;
import
cn.com.uitech.authorization.annotation.FieldNameMapping
;
import
cn.com.uitech.authorization.enums.CtoStatusEnum
;
import
cn.com.uitech.authorization.enums.SalesVisibleEnum
;
import
cn.com.uitech.authorization.exception.BizException
;
import
cn.com.uitech.authorization.mapper.CharacteristicValueMapper
;
import
cn.com.uitech.authorization.pojo.dto.*
;
...
...
@@ -10,7 +7,7 @@ import cn.com.uitech.authorization.pojo.entity.CharacteristicValue;
import
cn.com.uitech.authorization.pojo.entity.OdRelation
;
import
cn.com.uitech.authorization.service.CharacteristicValueService
;
import
cn.com.uitech.authorization.utils.ApiResult
;
import
cn.com.uitech.authorization.utils.
ProductExportUtils
;
import
cn.com.uitech.authorization.utils.
DateUitl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageHelper
;
...
...
@@ -18,12 +15,9 @@ import com.github.pagehelper.PageInfo;
import
com.google.common.collect.Lists
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.poi.hssf.usermodel.HSSFDateUtil
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.openxml4j.util.ZipSecureFile
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -40,9 +34,10 @@ import org.springframework.web.client.RestTemplate;
import
org.springframework.web.multipart.MultipartFile
;
import
tk.mybatis.mapper.entity.Condition
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.OutputStream
;
import
java.
lang.reflect.Field
;
import
java.
nio.charset.StandardCharsets
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -210,72 +205,237 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
@Override
public
void
exportCharacteristicValue
(
CharacteristicValueRequestParamDto
dto
,
HttpServletResponse
response
)
{
//根据页面输入框查询要导出的数据
List
<
CharacteristicValueExportDto
>
list
=
characteristicValueMapper
.
exportCharacteristicValue
(
dto
);
try
{
//标题
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
String
name
=
simpleDateFormat
.
format
(
new
Date
());
String
sheetName
=
list
.
get
(
0
).
getSuperBomName
();
//获取表头
ArrayList
<
String
>
titList
=
getFiledName
(
new
CharacteristicValueExportDto
());
//数据转list中list
List
<
String
[]>
datalist
=
getListData
(
list
);
//下载
SXSSFWorkbook
sxssfWorkbook
=
ProductExportUtils
.
getSXSSFWorkbook
(
sheetName
,
titList
,
datalist
);
ProductExportUtils
.
export
(
sxssfWorkbook
,
sheetName
+
name
,
response
);
Date
date
=
DateUitl
.
getNowAll
();
String
format
=
DateUitl
.
format
(
date
,
"yyyy-MM-dd"
);
String
[]
split
=
format
.
split
(
"-"
);
StringBuilder
worktableTitle
=
new
StringBuilder
();
for
(
String
string
:
split
)
{
worktableTitle
.
append
(
string
);
}
String
file
=
""
;
List
<
CharacteristicValueExportDto
>
priceModelList
=
new
ArrayList
<>();
List
<
CharacteristicValueExportDto
>
excelDtos
=
new
ArrayList
<>();
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
file
=
dto
.
getSuperBomCode
()
+
worktableTitle
+
".xls"
;
//根据页面输入框查询要导出的数据
priceModelList
=
characteristicValueMapper
.
exportCharacteristicValue
(
dto
);
excelDtos
=
exportStandBom
(
priceModelList
);
wb
=
exportExcelBom
(
excelDtos
);
String
filename
=
null
;
filename
=
new
String
(
file
.
getBytes
(
"GBK"
),
StandardCharsets
.
ISO_8859_1
);
response
.
setContentType
(
"APPLICATION/OCTET-STREAM"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=\""
+
filename
+
"\""
);
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
wb
.
write
(
outputStream
);
outputStream
.
close
();
}
catch
(
Exception
e
)
{
throw
new
BizException
(
ApiResult
.
INTERNAL_SERVER_ERROR
,
e
.
getMessage
());
}
}
/**
* @param list
* @return
* @desc 把对象转数组
*/
public
List
<
String
[]>
getListData
(
List
<
CharacteristicValueExportDto
>
list
)
{
List
<
String
[]>
dataList
=
Lists
.
newArrayList
();
String
[]
str
=
new
String
[]{};
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
String
[]
arrDate
=
new
String
[
6
];
CharacteristicValueExportDto
dto
=
list
.
get
(
i
);
private
List
<
CharacteristicValueExportDto
>
exportStandBom
(
List
<
CharacteristicValueExportDto
>
priceModelList
)
{
List
<
CharacteristicValueExportDto
>
excelDtos
=
new
ArrayList
<>();
for
(
CharacteristicValueExportDto
priceInfoDto
:
priceModelList
)
{
CharacteristicValueExportDto
dto
=
new
CharacteristicValueExportDto
();
//"SuperBOM", "特征编码", "特征名称",
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getSuperBomCode
()))
{
dto
.
setSuperBomCode
(
priceInfoDto
.
getSuperBomCode
());
}
else
{
dto
.
setSuperBomCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacteristicCode
()))
{
dto
.
setCharacteristicCode
(
priceInfoDto
.
getCharacteristicCode
());
}
else
{
dto
.
setCharacteristicCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacteristicName
()))
{
dto
.
setCharacteristicName
(
priceInfoDto
.
getCharacteristicName
());
}
else
{
dto
.
setCharacteristicName
(
null
);
}
//"特征值编号", "PLM名称", "销售名称",
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacteristicValueCode
()))
{
dto
.
setCharacteristicValueCode
(
priceInfoDto
.
getCharacteristicValueCode
());
}
else
{
dto
.
setCharacteristicValueCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacteristicValueName
()))
{
dto
.
setCharacteristicValueName
(
priceInfoDto
.
getCharacteristicValueName
());
}
else
{
dto
.
setCharacteristicValueName
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getUnisSalesVName
()))
{
dto
.
setUnisSalesVName
(
priceInfoDto
.
getUnisSalesVName
());
}
else
{
dto
.
setUnisSalesVName
(
null
);
}
//"是否可卖", "ZPHCode", "ZPHName",
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getIsState
()))
{
dto
.
setIsState
(
priceInfoDto
.
getIsState
());
}
else
{
dto
.
setIsState
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getZphCode
()))
{
dto
.
setZphCode
(
priceInfoDto
.
getZphCode
());
}
else
{
dto
.
setZphCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getZphName
()))
{
dto
.
setZphName
(
priceInfoDto
.
getZphName
());
}
else
{
dto
.
setZphName
(
null
);
}
//"开始时间", "H3C对照关系"
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getQualifyDate
()))
{
dto
.
setQualifyDate
(
priceInfoDto
.
getQualifyDate
());
}
else
{
dto
.
setQualifyDate
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getH3cCValue
()))
{
dto
.
setH3cCValue
(
priceInfoDto
.
getH3cCValue
());
}
else
{
dto
.
setH3cCValue
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getH3cDeliverCode
()))
{
dto
.
setH3cDeliverCode
(
priceInfoDto
.
getH3cDeliverCode
());
}
else
{
dto
.
setH3cDeliverCode
(
null
);
}
excelDtos
.
add
(
dto
);
}
return
excelDtos
;
}
arrDate
[
0
]
=
dto
.
getSuperBomName
();
arrDate
[
1
]
=
dto
.
getCharacteristicValueCode
();
arrDate
[
2
]
=
dto
.
getSuperBomCode
();
private
HSSFWorkbook
exportExcelBom
(
List
<
CharacteristicValueExportDto
>
excelDtos
)
{
String
[]
excelHeader
=
new
String
[]{
"SuperBOM"
,
"特征编码"
,
"特征名称"
,
"特征值编码"
,
"PLM名称"
,
"销售名称"
,
"是否可卖"
,
"ZPHCode"
,
"ZPHName"
,
"开始时间"
,
"H3C对照关系"
,
"H3C交付码"
};
arrDate
[
3
]
=
dto
.
getIsState
();
arrDate
[
4
]
=
dto
.
getIsShow
();
arrDate
[
5
]
=
dto
.
getBomStatus
();
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
HSSFSheet
sheet
=
workbook
.
createSheet
();
// 产生表格标题行
HSSFRow
titleRow
=
sheet
.
createRow
(
1
);
dataList
.
add
(
arrDate
);
}
return
dataList
;
// 定义所需列数
int
columnNum
=
excelHeader
.
length
;
HSSFRow
rowRowName
=
sheet
.
createRow
(
0
);
// 在索引2的位置创建行(最顶端的行开始的第二行)
// 将列头设置到sheet的单元格中
for
(
int
n
=
0
;
n
<
columnNum
;
n
++)
{
CellStyle
style
=
workbook
.
createCellStyle
();
HSSFCell
cellRowName
=
rowRowName
.
createCell
(
n
);
// 创建列头对应个数的单元格
cellRowName
.
setCellType
(
HSSFCell
.
CELL_TYPE_STRING
);
cellRowName
.
setCellValue
(
excelHeader
[
n
]);
// 设置列头单元格的值
style
.
setFillPattern
(
CellStyle
.
SOLID_FOREGROUND
);
style
.
setFillForegroundColor
(
IndexedColors
.
WHITE
.
getIndex
());
cellRowName
.
setCellStyle
(
style
);
// 设置列头单元格样式
}
;
// 添加表内容
for
(
int
i
=
0
;
i
<
excelDtos
.
size
();
i
++)
{
HSSFRow
ContentRow
=
sheet
.
createRow
(
i
+
1
);
//"SuperBOM", "特征编码", "特征名称",
/**
* @param target
* @return
* @throws Exception
* @desc 根据自定义注解获取到处文件列名
*/
public
ArrayList
<
String
>
getFiledName
(
Object
target
)
throws
Exception
{
ArrayList
<
String
>
list
=
Lists
.
newArrayList
();
Field
[]
fields
=
target
.
getClass
().
getDeclaredFields
();
String
[]
fieldNames
=
new
String
[
fields
.
length
];
for
(
int
i
=
0
;
i
<
fields
.
length
;
++
i
)
{
fieldNames
[
i
]
=
fields
[
i
].
getName
();
Field
declaredField
=
target
.
getClass
().
getDeclaredField
(
fields
[
i
].
getName
());
FieldNameMapping
annotation
=
declaredField
.
getAnnotation
(
FieldNameMapping
.
class
);
if
(
null
!=
annotation
)
{
list
.
add
(
annotation
.
value
());
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getSuperBomCode
()))
{
ContentRow
.
createCell
(
0
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
0
).
setCellValue
(
excelDtos
.
get
(
i
).
getSuperBomCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacteristicCode
()))
{
ContentRow
.
createCell
(
1
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
1
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacteristicCode
());
}
return
list
;
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacteristicName
()))
{
ContentRow
.
createCell
(
2
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
2
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacteristicName
());
}
//"特征值编号", "PLM名称", "销售名称",
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacteristicValueCode
()))
{
ContentRow
.
createCell
(
3
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
3
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacteristicValueCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacteristicValueName
()))
{
ContentRow
.
createCell
(
4
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
4
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacteristicValueName
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getUnisSalesVName
()))
{
ContentRow
.
createCell
(
5
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
5
).
setCellValue
(
excelDtos
.
get
(
i
).
getUnisSalesVName
());
}
//"是否可卖", "ZPHCode", "ZPHName",
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getIsState
()))
{
ContentRow
.
createCell
(
6
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
6
).
setCellValue
(
excelDtos
.
get
(
i
).
getIsState
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getZphCode
()))
{
ContentRow
.
createCell
(
7
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
7
).
setCellValue
(
excelDtos
.
get
(
i
).
getZphCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getZphName
()))
{
ContentRow
.
createCell
(
8
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
8
).
setCellValue
(
excelDtos
.
get
(
i
).
getZphName
());
}
//"开始时间", "H3C对照关系"
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getQualifyDate
()))
{
ContentRow
.
createCell
(
9
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
9
).
setCellValue
(
excelDtos
.
get
(
i
).
getQualifyDate
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getH3cCValue
()))
{
ContentRow
.
createCell
(
10
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
10
).
setCellValue
(
excelDtos
.
get
(
i
).
getH3cCValue
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getH3cDeliverCode
()))
{
ContentRow
.
createCell
(
11
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
11
).
setCellValue
(
excelDtos
.
get
(
i
).
getH3cDeliverCode
());
}
}
// 让列宽随着导出的列长自动适应
for
(
int
colNum
=
0
;
colNum
<
columnNum
;
colNum
++)
{
int
columnWidth
=
sheet
.
getColumnWidth
(
colNum
)
/
256
;
for
(
int
rowNum
=
0
;
rowNum
<
sheet
.
getLastRowNum
();
rowNum
++)
{
HSSFRow
currentRow
;
// 当前行未被使用过
if
(
sheet
.
getRow
(
rowNum
)
==
null
)
{
currentRow
=
sheet
.
createRow
(
rowNum
);
}
else
{
currentRow
=
sheet
.
getRow
(
rowNum
);
}
if
(
currentRow
.
getCell
(
colNum
)
!=
null
)
{
HSSFCell
currentCell
=
currentRow
.
getCell
(
colNum
);
if
(
currentCell
.
getCellType
()
==
HSSFCell
.
CELL_TYPE_STRING
)
{
int
length
=
currentCell
.
getStringCellValue
().
getBytes
().
length
;
if
(
columnWidth
<
length
)
{
columnWidth
=
length
;
}
}
}
}
if
(
colNum
==
0
)
{
sheet
.
setColumnWidth
(
colNum
,
(
columnWidth
-
2
)
*
256
);
}
else
{
sheet
.
setColumnWidth
(
colNum
,
(
columnWidth
+
4
)
*
256
);
}
}
return
workbook
;
}
/**
...
...
@@ -294,9 +454,9 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
List
<
CharacteristicValueExportDto
>
list
=
uploadExcl
(
file
);
//非空校验
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
ArrayList
<
String
>
checkFileIsN
null
=
checkFileIsNn
ull
(
list
);
if
(!
CollectionUtils
.
isEmpty
(
checkFileIsN
n
ull
))
{
return
String
.
valueOf
(
checkFileIsN
n
ull
);
ArrayList
<
String
>
checkFileIsN
ull
=
checkFileIsN
ull
(
list
);
if
(!
CollectionUtils
.
isEmpty
(
checkFileIsNull
))
{
return
String
.
valueOf
(
checkFileIsNull
);
}
}
else
{
}
...
...
@@ -316,15 +476,16 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
list
.
stream
().
forEach
((
dto
)
->
{
CharacteristicValue
c
=
new
CharacteristicValue
();
c
.
setCharacteristicValueCode
(
dto
.
getCharacteristicValueCode
());
c
.
setIsState
(
CtoStatusEnum
.
getCode
(
dto
.
getIsState
()));
c
.
setIsShow
(
SalesVisibleEnum
.
getCode
(
dto
.
getIsShow
()));
c
.
setCharacteristicCode
(
dto
.
getCharacteristicCode
());
c
.
setSuperBomCode
(
dto
.
getSuperBomCode
());
c
.
setH3cCValue
(
dto
.
getH3cCValue
());
c
.
setUnisSalesVName
(
dto
.
getUnisSalesVName
());
c
.
setH3cDeliverCode
(
dto
.
getH3cDeliverCode
());
updateList
.
add
(
c
);
});
for
(
CharacteristicValue
c
:
updateList
)
{
Condition
condition
=
characteristicValueMapper
.
getCondition
();
condition
.
createCriteria
().
andEqualTo
(
"characteristicValueCode"
,
c
.
getCharacteristicValueCode
());
characteristicValueMapper
.
updateByExampleSelective
(
c
,
condition
);
for
(
CharacteristicValue
v
:
updateList
)
{
characteristicValueMapper
.
updateCharacteristicValue
(
v
);
}
}
...
...
@@ -335,20 +496,23 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
* @return
* @desc 对上传的数据做非空校验
*/
public
ArrayList
<
String
>
checkFileIsN
n
ull
(
List
<
CharacteristicValueExportDto
>
list
)
{
public
ArrayList
<
String
>
checkFileIsNull
(
List
<
CharacteristicValueExportDto
>
list
)
{
ArrayList
<
String
>
checkList
=
new
ArrayList
<>();
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
CharacteristicValueExportDto
item
=
list
.
get
(
i
);
if
(
StringUtils
.
isBlank
(
item
.
getSuperBomCode
()))
{
sb
.
append
(
"SuperBom编号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
item
.
getCharacteristicCode
()))
{
sb
.
append
(
"特征编号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
item
.
getCharacteristicValueCode
()))
{
sb
.
append
(
"特征值编号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
item
.
getIsState
()))
{
sb
.
append
(
"特征值可卖状态不能为空"
);
}
if
(
StringUtils
.
isBlank
(
item
.
getIsShow
()))
{
sb
.
append
(
"特征值可见状态不能为空"
);
}
if
(
StringUtils
.
isNotBlank
(
sb
.
toString
()))
{
sb
.
insert
(
0
,
"上传文件的第"
+
i
+
"行数据:"
);
checkList
.
add
(
sb
.
toString
());
...
...
@@ -371,8 +535,10 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
try
{
String
filename
=
file
.
getOriginalFilename
();
if
(
filename
.
endsWith
(
"xls"
))
{
ZipSecureFile
.
setMinInflateRatio
(-
1.0d
);
wook
=
new
HSSFWorkbook
(
file
.
getInputStream
());
}
else
if
(
filename
.
endsWith
(
"xlsx"
))
{
ZipSecureFile
.
setMinInflateRatio
(-
1.0d
);
wook
=
new
XSSFWorkbook
(
file
.
getInputStream
());
}
...
...
@@ -406,12 +572,17 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
try
{
for
(
int
i
=
0
;
i
<
cells
;
i
++)
{
//读取到内存的只保留有更新逻辑的字段
dto
.
setSuperBomName
(
getCellValueByCell
(
row
.
getCell
(
0
)));
dto
.
setCharacteristicValueCode
(
getCellValueByCell
(
row
.
getCell
(
1
)));
dto
.
setSuperBomCode
(
getCellValueByCell
(
row
.
getCell
(
2
)));
dto
.
setIsState
(
getCellValueByCell
(
row
.
getCell
(
3
)));
dto
.
setIsShow
(
getCellValueByCell
(
row
.
getCell
(
4
)));
dto
.
setBomStatus
(
getCellValueByCell
(
row
.
getCell
(
5
)));
dto
.
setSuperBomCode
(
getCellValueByCell
(
row
.
getCell
(
0
)));
dto
.
setCharacteristicCode
(
getCellValueByCell
(
row
.
getCell
(
1
)));
dto
.
setCharacteristicName
(
getCellValueByCell
(
row
.
getCell
(
2
)));
dto
.
setCharacteristicValueCode
(
getCellValueByCell
(
row
.
getCell
(
3
)));
dto
.
setCharacteristicValueName
(
getCellValueByCell
(
row
.
getCell
(
4
)));
dto
.
setUnisSalesVName
(
getCellValueByCell
(
row
.
getCell
(
5
)));
dto
.
setIsState
(
getCellValueByCell
(
row
.
getCell
(
6
)));
dto
.
setZphCode
(
getCellValueByCell
(
row
.
getCell
(
7
)));
dto
.
setZphName
(
getCellValueByCell
(
row
.
getCell
(
8
)));
dto
.
setQualifyDate
(
getCellValueByCell
(
row
.
getCell
(
9
)));
dto
.
setH3cCValue
(
getCellValueByCell
(
row
.
getCell
(
10
)));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
src/main/java/cn/com/uitech/authorization/service/impl/IntegrateServiceImpl.java
View file @
c4d2be67
...
...
@@ -165,6 +165,7 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristic
.
setUnisSalesCName
(
saveSuperCharacterInputDto
.
getOptionName
());
characteristic
.
setIsShow
(
1
);
characteristic
.
setIsHidden
(
1
);
characteristic
.
setIsH3C
(
0
);
characteristic
.
setCharacteristicType
(
"否"
);
Characteristic
getOne
=
characteristicMapper
.
selectByCode
(
characteristic
);
if
(!
ObjectUtils
.
isEmpty
(
getOne
))
{
...
...
@@ -683,15 +684,15 @@ public class IntegrateServiceImpl implements IntegrateService {
GetProductOutDto
result
=
new
GetProductOutDto
();
UserInfo
getOne
=
userInfoMapper
.
getUser
(
userinfo
);
if
(!
ObjectUtils
.
isEmpty
(
getOne
))
{
String
redis
=
redisHelper
.
get
(
"unis_cpq:"
+
getOne
.
getUserCode
());
String
redis
=
redisHelper
.
get
(
"unis_cpq:"
+
getOne
.
getUserCode
()
.
toUpperCase
()
);
if
(
StringUtils
.
isEmpty
(
redis
))
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date
=
new
Date
(
System
.
currentTimeMillis
());
String
md5Str
=
MD5Util
.
getMD5Str
(
getOne
.
getPass
W
ord
()
+
"_unis_cpq_"
+
getOne
.
getUserCode
()
+
formatter
.
format
(
date
));
String
md5Str
=
MD5Util
.
getMD5Str
(
getOne
.
getPass
w
ord
()
+
"_unis_cpq_"
+
getOne
.
getUserCode
()
+
formatter
.
format
(
date
));
String
doubleMd5
=
MD5Util
.
getMD5Str
(
md5Str
);
result
.
setData
(
doubleMd5
);
result
.
setCode
(
200
);
redisHelper
.
set
(
"unis_cpq:"
+
getOne
.
getUserCode
(),
doubleMd5
,
86400
);
redisHelper
.
set
(
"unis_cpq:"
+
getOne
.
getUserCode
()
.
toUpperCase
()
,
doubleMd5
,
86400
);
}
else
{
result
.
setData
(
redis
);
result
.
setCode
(
200
);
...
...
@@ -736,7 +737,7 @@ public class IntegrateServiceImpl implements IntegrateService {
GetProductOutDto
result
=
new
GetProductOutDto
();
UserInfo
getOne
=
userInfoMapper
.
getUserOne
(
userinfo
);
if
(!
ObjectUtils
.
isEmpty
(
getOne
))
{
String
redis
=
redisHelper
.
get
(
"unis_cpq:"
+
userinfo
.
getUserCode
());
String
redis
=
redisHelper
.
get
(
"unis_cpq:"
+
userinfo
.
getUserCode
()
.
toUpperCase
()
);
if
(!
StringUtils
.
isEmpty
(
redis
))
{
if
(
userinfo
.
getToken
().
equals
(
redis
))
{
result
.
setMsg
(
null
);
...
...
@@ -763,18 +764,18 @@ public class IntegrateServiceImpl implements IntegrateService {
public
Object
ldapAuth
(
UserInfo
userinfo
)
{
GetProductOutDto
result
=
new
GetProductOutDto
();
EqualsFilter
filter
=
new
EqualsFilter
(
"sAMAccountName"
,
userinfo
.
getUserCode
());
boolean
authenticate
=
ldapTemplate
.
authenticate
(
""
,
filter
.
toString
(),
userinfo
.
getPass
W
ord
());
boolean
authenticate
=
ldapTemplate
.
authenticate
(
""
,
filter
.
toString
(),
userinfo
.
getPass
w
ord
());
//true 存在
if
(
authenticate
)
{
String
redis
=
redisHelper
.
get
(
"unis_cpq:"
+
userinfo
.
getUserCode
());
String
redis
=
redisHelper
.
get
(
"unis_cpq:"
+
userinfo
.
getUserCode
()
.
toUpperCase
()
);
if
(
StringUtils
.
isEmpty
(
redis
))
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date
=
new
Date
(
System
.
currentTimeMillis
());
String
md5Str
=
MD5Util
.
getMD5Str
(
userinfo
.
getPass
W
ord
()
+
"_unis_cpq_"
+
userinfo
.
getUserCode
()
+
formatter
.
format
(
date
));
String
md5Str
=
MD5Util
.
getMD5Str
(
userinfo
.
getPass
w
ord
()
+
"_unis_cpq_"
+
userinfo
.
getUserCode
()
+
formatter
.
format
(
date
));
String
doubleMd5
=
MD5Util
.
getMD5Str
(
md5Str
);
result
.
setData
(
doubleMd5
);
result
.
setCode
(
200
);
redisHelper
.
set
(
"unis_cpq:"
+
userinfo
.
getUserCode
(),
doubleMd5
,
86400
);
redisHelper
.
set
(
"unis_cpq:"
+
userinfo
.
getUserCode
()
.
toUpperCase
()
,
doubleMd5
,
86400
);
//用于代码校验token
//redisHelper.set("unis_cpq:" + doubleMd5, doubleMd5, 86400);
}
else
{
...
...
src/main/java/cn/com/uitech/authorization/service/impl/SuperBomPriceCalculateServiceImpl.java
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
service
.
impl
;
import
cn.com.uitech.authorization.exception.BizException
;
import
cn.com.uitech.authorization.exception.BusinessException
;
import
cn.com.uitech.authorization.mapper.BasicsPriceInfoMapper
;
import
cn.com.uitech.authorization.mapper.SuperBomPriceCalculateMapper
;
import
cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto
;
import
cn.com.uitech.authorization.pojo.dto.GetProductOutDto
;
import
cn.com.uitech.authorization.pojo.dto.SuperCharacterPriceInfoDto
;
import
cn.com.uitech.authorization.pojo.entity.*
;
import
cn.com.uitech.authorization.service.BasicsPriceInfoService
;
import
cn.com.uitech.authorization.service.SuperBomPriceCalculateService
;
import
cn.com.uitech.authorization.utils.ApiResult
;
import
cn.com.uitech.authorization.utils.DateUitl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.openxml4j.util.ZipSecureFile
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.math.BigDecimal
;
import
java.nio.charset.StandardCharsets
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -240,4 +258,489 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate
List
<
SuperCharacterPriceInfoEntity
>
list
=
superBomPriceCalculateMapper
.
getCharacterValueList
(
characteristicValue
);
return
new
PageInfo
(
list
);
}
@Override
public
void
exportCharacteristicValuePrice
(
CharacteristicValueExportDto
dto
,
HttpServletResponse
response
)
{
try
{
Date
date
=
DateUitl
.
getNowAll
();
String
format
=
DateUitl
.
format
(
date
,
"yyyy-MM-dd"
);
String
[]
split
=
format
.
split
(
"-"
);
StringBuilder
worktableTitle
=
new
StringBuilder
();
for
(
String
string
:
split
)
{
worktableTitle
.
append
(
string
);
}
String
file
=
""
;
List
<
SuperCharacterPriceInfoDto
>
priceModelList
=
new
ArrayList
<>();
List
<
SuperCharacterPriceInfoDto
>
excelDtos
=
new
ArrayList
<>();
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
file
=
"特征值价格"
+
worktableTitle
+
".xls"
;
//根据页面输入框查询要导出的数据
priceModelList
=
superBomPriceCalculateMapper
.
exportCharacteristicValuePrice
(
dto
);
if
(
ObjectUtils
.
isEmpty
(
priceModelList
))
{
BasicsPriceInfoEntity
basicsPriceInfoEntity
=
new
BasicsPriceInfoEntity
();
basicsPriceInfoEntity
.
setSuperBomCode
(
dto
.
getSuperBomCode
());
basicsPriceInfoEntity
.
setBrand
(
dto
.
getBrand
());
basicsPriceInfoEntity
.
setProductClassCode
(
dto
.
getProductClassCode
());
basicsPriceInfoEntity
.
setPriceType
(
1
);
BasicsPriceInfoEntity
basicsPriceInfo
;
basicsPriceInfo
=
superBomPriceCalculateMapper
.
getBasicsPriceInfo
(
basicsPriceInfoEntity
);
if
(
ObjectUtils
.
isEmpty
(
basicsPriceInfo
)
&&
!
StringUtils
.
isEmpty
(
basicsPriceInfoEntity
.
getSuperBomCode
()))
{
basicsPriceInfoEntity
.
setSuperBomCode
(
null
);
basicsPriceInfo
=
superBomPriceCalculateMapper
.
getBasicsPriceInfo
(
basicsPriceInfoEntity
);
if
(
ObjectUtils
.
isEmpty
(
basicsPriceInfo
))
{
basicsPriceInfoEntity
.
setPriceType
(
2
);
basicsPriceInfo
=
superBomPriceCalculateMapper
.
getBasicsPriceInfo
(
basicsPriceInfoEntity
);
if
(
ObjectUtils
.
isEmpty
(
basicsPriceInfo
)
&&
!
StringUtils
.
isEmpty
(
basicsPriceInfoEntity
.
getSuperBomCode
()))
{
basicsPriceInfoEntity
.
setSuperBomCode
(
null
);
basicsPriceInfo
=
superBomPriceCalculateMapper
.
getBasicsPriceInfo
(
basicsPriceInfoEntity
);
if
(
ObjectUtils
.
isEmpty
(
basicsPriceInfo
))
{
throw
new
BusinessException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
"请维护价格系数!"
);
}
}
}
}
for
(
SuperCharacterPriceInfoDto
superCharacterPriceInfoDto
:
priceModelList
)
{
if
(
basicsPriceInfo
.
getPriceType
().
equals
(
1
))
{
superCharacterPriceInfoDto
.
setPriceType
(
"成本定价法"
);
}
else
{
superCharacterPriceInfoDto
.
setPriceType
(
"市场定价法"
);
}
}
}
excelDtos
=
exportStandBom
(
priceModelList
);
wb
=
exportExcelBom
(
excelDtos
);
String
filename
=
null
;
filename
=
new
String
(
file
.
getBytes
(
"GBK"
),
StandardCharsets
.
ISO_8859_1
);
response
.
setContentType
(
"APPLICATION/OCTET-STREAM"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=\""
+
filename
+
"\""
);
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
wb
.
write
(
outputStream
);
outputStream
.
close
();
}
catch
(
Exception
e
)
{
throw
new
BizException
(
ApiResult
.
INTERNAL_SERVER_ERROR
,
e
.
getMessage
());
}
}
private
List
<
SuperCharacterPriceInfoDto
>
exportStandBom
(
List
<
SuperCharacterPriceInfoDto
>
priceModelList
)
{
List
<
SuperCharacterPriceInfoDto
>
excelDtos
=
new
ArrayList
<>();
for
(
SuperCharacterPriceInfoDto
priceInfoDto
:
priceModelList
)
{
SuperCharacterPriceInfoDto
dto
=
new
SuperCharacterPriceInfoDto
();
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getSuperBomCode
()))
{
dto
.
setSuperBomCode
(
priceInfoDto
.
getSuperBomCode
());
}
else
{
dto
.
setSuperBomCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getSuperBomName
()))
{
dto
.
setSuperBomName
(
priceInfoDto
.
getSuperBomName
());
}
else
{
dto
.
setSuperBomName
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getPriceType
()))
{
dto
.
setPriceType
(
priceInfoDto
.
getPriceType
());
}
else
{
dto
.
setPriceType
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacterCode
()))
{
dto
.
setCharacterCode
(
priceInfoDto
.
getCharacterCode
());
}
else
{
dto
.
setCharacterCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacterName
()))
{
dto
.
setCharacterName
(
priceInfoDto
.
getCharacterName
());
}
else
{
dto
.
setCharacterName
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacterValueCode
()))
{
dto
.
setCharacterValueCode
(
priceInfoDto
.
getCharacterValueCode
());
}
else
{
dto
.
setCharacterValueCode
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getCharacterValueName
()))
{
dto
.
setCharacterValueName
(
priceInfoDto
.
getCharacterValueName
());
}
else
{
dto
.
setCharacterValueName
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getActualPrice
()))
{
dto
.
setActualPrice
(
priceInfoDto
.
getActualPrice
());
}
else
{
dto
.
setActualPrice
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getLeve0Price
()))
{
dto
.
setLeve0Price
(
priceInfoDto
.
getLeve0Price
());
}
else
{
dto
.
setLeve0Price
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getLeve1Price
()))
{
dto
.
setLeve1Price
(
priceInfoDto
.
getLeve1Price
());
}
else
{
dto
.
setLeve1Price
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getLeve2Price
()))
{
dto
.
setLeve2Price
(
priceInfoDto
.
getLeve2Price
());
}
else
{
dto
.
setLeve2Price
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getLeve3Price
()))
{
dto
.
setLeve3Price
(
priceInfoDto
.
getLeve3Price
());
}
else
{
dto
.
setLeve3Price
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getSuperBomCode
()))
{
dto
.
setLeve4Price
(
priceInfoDto
.
getLeve4Price
());
}
else
{
dto
.
setLeve4Price
(
null
);
}
if
(!
ObjectUtils
.
isEmpty
(
priceInfoDto
.
getActualPrice
()))
{
dto
.
setAgentPrice
(
priceInfoDto
.
getAgentPrice
());
}
else
{
dto
.
setAgentPrice
(
null
);
}
excelDtos
.
add
(
dto
);
}
return
excelDtos
;
}
private
HSSFWorkbook
exportExcelBom
(
List
<
SuperCharacterPriceInfoDto
>
excelDtos
)
{
String
[]
excelHeader
=
new
String
[]{
"SuperBOM"
,
"SuperBOM名称"
,
"定价类型"
,
"特征编码"
,
"特征名称"
,
"特征值编码"
,
"特征值名称"
,
"真实成本"
,
"标准成本"
,
"一级调整价"
,
"二级调整价"
,
"三级调整价"
,
"四级调整价"
,
"代理价"
};
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
HSSFSheet
sheet
=
workbook
.
createSheet
();
// 产生表格标题行
HSSFRow
titleRow
=
sheet
.
createRow
(
1
);
// 定义所需列数
int
columnNum
=
excelHeader
.
length
;
HSSFRow
rowRowName
=
sheet
.
createRow
(
0
);
// 在索引2的位置创建行(最顶端的行开始的第二行)
// 将列头设置到sheet的单元格中
for
(
int
n
=
0
;
n
<
columnNum
;
n
++)
{
CellStyle
style
=
workbook
.
createCellStyle
();
HSSFCell
cellRowName
=
rowRowName
.
createCell
(
n
);
// 创建列头对应个数的单元格
cellRowName
.
setCellType
(
HSSFCell
.
CELL_TYPE_STRING
);
cellRowName
.
setCellValue
(
excelHeader
[
n
]);
// 设置列头单元格的值
style
.
setFillPattern
(
CellStyle
.
SOLID_FOREGROUND
);
style
.
setFillForegroundColor
(
IndexedColors
.
WHITE
.
getIndex
());
cellRowName
.
setCellStyle
(
style
);
// 设置列头单元格样式
}
// 添加表内容
for
(
int
i
=
0
;
i
<
excelDtos
.
size
();
i
++)
{
HSSFRow
ContentRow
=
sheet
.
createRow
(
i
+
1
);
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getSuperBomCode
()))
{
ContentRow
.
createCell
(
0
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
0
).
setCellValue
(
excelDtos
.
get
(
i
).
getSuperBomCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getSuperBomName
()))
{
ContentRow
.
createCell
(
1
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
1
).
setCellValue
(
excelDtos
.
get
(
i
).
getSuperBomName
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getPriceType
()))
{
ContentRow
.
createCell
(
2
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
2
).
setCellValue
(
excelDtos
.
get
(
i
).
getPriceType
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacterCode
()))
{
ContentRow
.
createCell
(
3
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
3
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacterCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacterName
()))
{
ContentRow
.
createCell
(
4
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
4
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacterName
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacterValueCode
()))
{
ContentRow
.
createCell
(
5
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
5
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacterValueCode
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getCharacterValueName
()))
{
ContentRow
.
createCell
(
6
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
6
).
setCellValue
(
excelDtos
.
get
(
i
).
getCharacterValueName
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getActualPrice
()))
{
ContentRow
.
createCell
(
7
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
7
).
setCellValue
(
excelDtos
.
get
(
i
).
getActualPrice
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getLeve0Price
()))
{
ContentRow
.
createCell
(
8
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
8
).
setCellValue
(
excelDtos
.
get
(
i
).
getLeve0Price
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getLeve1Price
()))
{
ContentRow
.
createCell
(
9
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
9
).
setCellValue
(
excelDtos
.
get
(
i
).
getLeve1Price
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getLeve2Price
()))
{
ContentRow
.
createCell
(
10
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
10
).
setCellValue
(
excelDtos
.
get
(
i
).
getLeve2Price
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getLeve3Price
()))
{
ContentRow
.
createCell
(
11
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
11
).
setCellValue
(
excelDtos
.
get
(
i
).
getLeve3Price
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getLeve4Price
()))
{
ContentRow
.
createCell
(
12
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
12
).
setCellValue
(
excelDtos
.
get
(
i
).
getLeve4Price
());
}
if
(
ObjectUtils
.
isEmpty
(
excelDtos
.
get
(
i
).
getAgentPrice
()))
{
ContentRow
.
createCell
(
13
).
setCellValue
(
""
);
}
else
{
ContentRow
.
createCell
(
13
).
setCellValue
(
excelDtos
.
get
(
i
).
getAgentPrice
());
}
}
// 让列宽随着导出的列长自动适应
for
(
int
colNum
=
0
;
colNum
<
columnNum
;
colNum
++)
{
int
columnWidth
=
sheet
.
getColumnWidth
(
colNum
)
/
256
;
for
(
int
rowNum
=
0
;
rowNum
<
sheet
.
getLastRowNum
();
rowNum
++)
{
HSSFRow
currentRow
;
// 当前行未被使用过
if
(
sheet
.
getRow
(
rowNum
)
==
null
)
{
currentRow
=
sheet
.
createRow
(
rowNum
);
}
else
{
currentRow
=
sheet
.
getRow
(
rowNum
);
}
if
(
currentRow
.
getCell
(
colNum
)
!=
null
)
{
HSSFCell
currentCell
=
currentRow
.
getCell
(
colNum
);
if
(
currentCell
.
getCellType
()
==
HSSFCell
.
CELL_TYPE_STRING
)
{
int
length
=
currentCell
.
getStringCellValue
().
getBytes
().
length
;
if
(
columnWidth
<
length
)
{
columnWidth
=
length
;
}
}
}
}
if
(
colNum
==
0
)
{
sheet
.
setColumnWidth
(
colNum
,
(
columnWidth
-
2
)
*
256
);
}
else
{
sheet
.
setColumnWidth
(
colNum
,
(
columnWidth
+
4
)
*
256
);
}
}
return
workbook
;
}
/**
* @param file
* @return
* @desc 特征值价格管理 上传文件更新
*/
@Override
public
String
batchUpdateByUpload
(
MultipartFile
file
)
{
int
result
=
0
;
//判断文件是否为空
if
(
null
==
file
||
file
.
isEmpty
())
{
throw
new
BizException
(
ApiResult
.
API_REQ_DATA_IS_FAIL
,
"特征值价格上传文件批量更新-上传文件为空"
);
}
//读取文件内容
List
<
SuperCharacterPriceInfoDto
>
list
=
uploadExcl
(
file
);
//非空校验
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
ArrayList
<
String
>
checkFileIsNull
=
checkFileIsNull
(
list
);
if
(!
CollectionUtils
.
isEmpty
(
checkFileIsNull
))
{
return
String
.
valueOf
(
checkFileIsNull
);
}
}
else
{
}
updateData
(
list
);
return
"更新附件内容成功"
;
}
/**
* @param list
*/
public
void
updateData
(
List
<
SuperCharacterPriceInfoDto
>
list
)
{
//更新数据库里数据
ArrayList
<
Characteristics
>
updateList
=
new
ArrayList
<>();
list
.
stream
().
forEach
((
dto
)
->
{
Characteristics
vPrice
=
new
Characteristics
();
vPrice
.
setSuperBomCode
(
dto
.
getSuperBomCode
());
vPrice
.
setCharacteristicCode
(
dto
.
getCharacterCode
());
vPrice
.
setCharacteristicName
(
dto
.
getCharacterName
());
vPrice
.
setCharacteristicValueCode
(
dto
.
getCharacterValueCode
());
vPrice
.
setCharacteristicValueName
(
dto
.
getCharacterValueName
());
if
(!
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
dto
.
getActualPrice
())){
vPrice
.
setActualPrice
(
BigDecimal
.
valueOf
(
Double
.
valueOf
(
dto
.
getActualPrice
())));
}
if
(!
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
dto
.
getLeve0Price
())){
vPrice
.
setLeve0Price
(
BigDecimal
.
valueOf
(
Double
.
valueOf
(
dto
.
getLeve0Price
())));
}
if
(!
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
dto
.
getLeve1Price
())){
vPrice
.
setLeve1Price
(
BigDecimal
.
valueOf
(
Double
.
valueOf
(
dto
.
getLeve1Price
())));
}
if
(!
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
dto
.
getLeve2Price
())){
vPrice
.
setLeve2Price
(
BigDecimal
.
valueOf
(
Double
.
valueOf
(
dto
.
getLeve2Price
())));
}
if
(!
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
dto
.
getLeve3Price
())){
vPrice
.
setLeve3Price
(
BigDecimal
.
valueOf
(
Double
.
valueOf
(
dto
.
getLeve3Price
())));
}
if
(!
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
dto
.
getLeve4Price
())){
vPrice
.
setLeve4Price
(
BigDecimal
.
valueOf
(
Double
.
valueOf
(
dto
.
getLeve4Price
())));
}
if
(!
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
dto
.
getAgentPrice
())){
vPrice
.
setAgentPrice
(
BigDecimal
.
valueOf
(
Double
.
valueOf
(
dto
.
getAgentPrice
())));
}
updateList
.
add
(
vPrice
);
});
for
(
Characteristics
info
:
updateList
)
{
superBomPriceCalculateMapper
.
updateCharacteristicInfo
(
info
);
}
}
/**
* @param list
* @return
* @desc 对上传的数据做非空校验
*/
public
ArrayList
<
String
>
checkFileIsNull
(
List
<
SuperCharacterPriceInfoDto
>
list
)
{
ArrayList
<
String
>
checkList
=
new
ArrayList
<>();
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
SuperCharacterPriceInfoDto
item
=
list
.
get
(
i
);
if
(
StringUtils
.
isBlank
(
item
.
getSuperBomCode
()))
{
sb
.
append
(
"SuperBom编号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
item
.
getCharacterCode
()))
{
sb
.
append
(
"特征编号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
item
.
getCharacterValueCode
()))
{
sb
.
append
(
"特征值编号不能为空"
);
}
if
(
StringUtils
.
isNotBlank
(
sb
.
toString
()))
{
sb
.
insert
(
0
,
"上传文件的第"
+
i
+
"行数据:"
);
checkList
.
add
(
sb
.
toString
());
}
}
return
checkList
;
}
/**
* @param file
* @return List<SuperCharacterPriceInfoDto>
* @desc 解析上传文件
*/
public
List
<
SuperCharacterPriceInfoDto
>
uploadExcl
(
MultipartFile
file
)
{
long
startDate
=
Calendar
.
getInstance
().
getTimeInMillis
();
List
<
SuperCharacterPriceInfoDto
>
list
=
Lists
.
newArrayList
();
Workbook
wook
=
null
;
try
{
String
filename
=
file
.
getOriginalFilename
();
if
(
filename
.
endsWith
(
"xls"
))
{
ZipSecureFile
.
setMinInflateRatio
(-
1.0d
);
wook
=
new
HSSFWorkbook
(
file
.
getInputStream
());
}
else
if
(
filename
.
endsWith
(
"xlsx"
))
{
ZipSecureFile
.
setMinInflateRatio
(-
1.0d
);
wook
=
new
XSSFWorkbook
(
file
.
getInputStream
());
}
int
numberOfSheets
=
wook
.
getNumberOfSheets
();
for
(
int
i
=
0
;
i
<
numberOfSheets
;
i
++)
{
Sheet
sheetAt
=
wook
.
getSheetAt
(
i
);
int
rows
=
sheetAt
.
getPhysicalNumberOfRows
();
for
(
int
j
=
1
;
j
<
rows
;
j
++)
{
Row
row
=
sheetAt
.
getRow
(
j
);
int
cells
=
row
.
getPhysicalNumberOfCells
();
//把每条数据封装进对象里
SuperCharacterPriceInfoDto
dto
=
setCharacteristicPriceExportDto
(
row
,
cells
);
list
.
add
(
dto
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
long
endDate
=
Calendar
.
getInstance
().
getTimeInMillis
();
return
list
;
}
/**
* @param row
* @param cells
* @return SuperCharacterPriceInfoDto
* @desc 把excel每行数据返回一个对象
*/
public
SuperCharacterPriceInfoDto
setCharacteristicPriceExportDto
(
Row
row
,
int
cells
)
{
SuperCharacterPriceInfoDto
dto
=
new
SuperCharacterPriceInfoDto
();
try
{
for
(
int
i
=
0
;
i
<
cells
;
i
++)
{
//读取到内存的只保留有更新逻辑的字段
dto
.
setSuperBomCode
(
getCellValueByCell
(
row
.
getCell
(
0
)));
dto
.
setSuperBomName
(
getCellValueByCell
(
row
.
getCell
(
1
)));
dto
.
setPriceType
(
getCellValueByCell
(
row
.
getCell
(
2
)));
dto
.
setCharacterCode
(
getCellValueByCell
(
row
.
getCell
(
3
)));
dto
.
setCharacterName
(
getCellValueByCell
(
row
.
getCell
(
4
)));
dto
.
setCharacterValueCode
(
getCellValueByCell
(
row
.
getCell
(
5
)));
dto
.
setCharacterValueName
(
getCellValueByCell
(
row
.
getCell
(
6
)));
dto
.
setActualPrice
(
getCellValueByCell
(
row
.
getCell
(
7
)));
dto
.
setLeve0Price
(
getCellValueByCell
(
row
.
getCell
(
8
)));
dto
.
setLeve1Price
(
getCellValueByCell
(
row
.
getCell
(
9
)));
dto
.
setLeve2Price
(
getCellValueByCell
(
row
.
getCell
(
10
)));
dto
.
setLeve3Price
(
getCellValueByCell
(
row
.
getCell
(
11
)));
dto
.
setLeve4Price
(
getCellValueByCell
(
row
.
getCell
(
12
)));
dto
.
setAgentPrice
(
getCellValueByCell
(
row
.
getCell
(
13
)));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
dto
;
}
/**
* @param cell
* @return
* @desc 获取单元格各类型值,返回字符串类型
*/
private
String
getCellValueByCell
(
Cell
cell
)
{
//判断是否为null或空串
if
(
cell
==
null
||
cell
.
toString
().
trim
().
equals
(
""
))
{
return
""
;
}
String
cellValue
=
""
;
int
cellType
=
cell
.
getCellType
();
switch
(
cellType
)
{
case
Cell
.
CELL_TYPE_STRING
:
//字符串类型
cellValue
=
cell
.
getStringCellValue
().
trim
();
break
;
case
Cell
.
CELL_TYPE_BOOLEAN
:
//布尔类型
cellValue
=
String
.
valueOf
(
cell
.
getBooleanCellValue
());
break
;
case
Cell
.
CELL_TYPE_NUMERIC
:
//数值类型
if
(
HSSFDateUtil
.
isCellDateFormatted
(
cell
))
{
//判断日期类型
cellValue
=
DateFormatUtils
.
format
(
cell
.
getDateCellValue
(),
"yyyy-MM-dd"
);
}
else
{
//否
cellValue
=
new
DecimalFormat
(
"#.######"
).
format
(
cell
.
getNumericCellValue
());
}
break
;
default
:
//其它类型,取空串吧
cellValue
=
""
;
break
;
}
return
cellValue
;
}
}
src/main/java/cn/com/uitech/authorization/service/impl/TempServiceImpl.java
View file @
c4d2be67
...
...
@@ -21,7 +21,6 @@ import java.util.List;
import
java.util.Map
;
@Service
@Transactional
public
class
TempServiceImpl
implements
TempServer
{
@Autowired
...
...
@@ -37,6 +36,8 @@ public class TempServiceImpl implements TempServer {
GetProductOutDto
result
=
new
GetProductOutDto
();
//获取未开始的信息进行操作
DeployTempParam
deployTempParam
=
tempMapper
.
getTempList
();
List
<
DeployTempItemParam
>
deployTempItemParamList
=
tempMapper
.
getTempListBySkuCode
(
deployTempParam
.
getOldSkuCode
());
deployTempParam
.
setDeployTempItemParams
(
deployTempItemParamList
);
if
(!
ObjectUtils
.
isEmpty
(
deployTempParam
)){
//循环生成configid,保存sku信息,申请sku
//构建生成配置参数
...
...
@@ -103,6 +104,8 @@ public class TempServiceImpl implements TempServer {
JSONObject
data
=
(
JSONObject
)
map
.
get
(
"data"
);
result
.
setCode
(
200
);
result
.
setData
(
data
);
deployTempParam
.
setStatus
(
"已完成"
);
tempMapper
.
updateTemp
(
deployTempParam
);
}
else
{
String
msg
=
(
String
)
map
.
get
(
"msg"
);
...
...
@@ -120,11 +123,12 @@ public class TempServiceImpl implements TempServer {
result
.
setMsg
(
msg
);
}
}
getTempList
();
}
else
{
result
.
setCode
(
200
);
result
.
setMsg
(
"数据初始化完成"
);
return
result
;
}
getTempList
();
return
result
;
}
}
src/main/java/cn/com/uitech/authorization/utils/DateUitl.java
0 → 100644
View file @
c4d2be67
package
cn
.
com
.
uitech
.
authorization
.
utils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
DateUitl
{
public
static
final
String
PATTERN_DATE_1
=
"yyyy-MM-dd"
;
public
static
final
String
PATTERN_DATE_2
=
"HH:mm:ss"
;
public
static
final
String
PATTERN_DATE_3
=
"yyyy-MM-dd HH:mm:ss"
;
private
DateUitl
()
{
}
public
static
String
getPreDay
(
String
dateString
,
int
i
)
throws
ParseException
{
Date
day
=
parseDate
(
dateString
,
DateUitl
.
PATTERN_DATE_1
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
day
);
cal
.
add
(
cal
.
DAY_OF_MONTH
,-
i
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
mDateTime
=
formatter
.
format
(
cal
.
getTime
());
Date
date
=
parseDate
(
mDateTime
,
DateUitl
.
PATTERN_DATE_1
);
String
str
=
format
(
date
,
DateUitl
.
PATTERN_DATE_1
);
System
.
err
.
println
(
str
);
return
str
;
}
public
static
String
getNextDay
(
String
dateString
,
int
i
)
throws
ParseException
{
Date
day
=
parseDate
(
dateString
,
DateUitl
.
PATTERN_DATE_1
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
day
);
cal
.
add
(
cal
.
DAY_OF_MONTH
,
i
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
mDateTime
=
formatter
.
format
(
cal
.
getTime
());
Date
date
=
parseDate
(
mDateTime
,
DateUitl
.
PATTERN_DATE_1
);
String
str
=
format
(
date
,
DateUitl
.
PATTERN_DATE_1
);
return
str
;
}
// 将字符串类型格式化为日期类型
public
static
Date
parseDate
(
String
dateString
,
String
pattern
)
throws
ParseException
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
Date
date
=
null
;
try
{
date
=
sdf
.
parse
(
dateString
);
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
throw
e
;
}
return
date
;
}
// 将日期类型格式化为字符串类型
public
static
String
format
(
Date
date
,
String
pattern
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
return
sdf
.
format
(
date
);
}
// 获取当前系统时间(字符串类型)
public
static
String
getCurrentDate
()
{
return
format
(
new
Date
(),
DateUitl
.
PATTERN_DATE_3
);
}
// 获取当前系统时间(字符串类型)
public
static
String
getCurrentDate
(
String
pattern
)
{
return
format
(
new
Date
(),
pattern
);
}
// 得到当前系统时间,包含年、月、日、时、分、秒
public
static
Date
getNowAll
()
throws
ParseException
{
return
parseDate
(
getCurrentDate
(),
DateUitl
.
PATTERN_DATE_3
);
}
// 得到当前系统时间,包含年、月、日
public
static
Date
getNowDate
()
throws
ParseException
{
return
parseDate
(
getCurrentDate
(),
DateUitl
.
PATTERN_DATE_1
);
}
/**
* 得到当前日期的前一天
* @throws ParseException
* */
@SuppressWarnings
(
"static-access"
)
public
static
Date
getPreDay
()
throws
ParseException
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
cal
.
DAY_OF_MONTH
,
-
1
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
mDateTime
=
formatter
.
format
(
cal
.
getTime
());
Date
date
=
parseDate
(
mDateTime
,
DateUitl
.
PATTERN_DATE_1
);
return
date
;
}
@SuppressWarnings
(
"static-access"
)
public
static
String
getPreDay
(
int
i
)
throws
ParseException
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
cal
.
DAY_OF_MONTH
,
i
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
mDateTime
=
formatter
.
format
(
cal
.
getTime
());
Date
date
=
parseDate
(
mDateTime
,
DateUitl
.
PATTERN_DATE_1
);
String
str
=
format
(
date
,
DateUitl
.
PATTERN_DATE_1
);
return
str
;
}
/**
* 得到当前日期的 后一天
* @throws ParseException
* */
@SuppressWarnings
(
"static-access"
)
public
static
Date
getNextDay
()
throws
ParseException
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
cal
.
DAY_OF_MONTH
,
1
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
mDateTime
=
formatter
.
format
(
cal
.
getTime
());
Date
date
=
parseDate
(
mDateTime
,
DateUitl
.
PATTERN_DATE_1
);
return
date
;
}
@SuppressWarnings
(
"static-access"
)
public
static
String
getNextDay
(
int
i
)
throws
ParseException
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
cal
.
DAY_OF_MONTH
,
i
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
mDateTime
=
formatter
.
format
(
cal
.
getTime
());
Date
date
=
parseDate
(
mDateTime
,
DateUitl
.
PATTERN_DATE_1
);
String
str
=
format
(
date
,
DateUitl
.
PATTERN_DATE_1
);
return
str
;
}
/**
* 得到当天星期几,用(1234567)表示
* */
@SuppressWarnings
(
"deprecation"
)
public
static
int
getWeekDate
()
{
Date
date
=
new
Date
();
int
weekDate
=
date
.
getDay
();
if
(
weekDate
==
0
)
{
weekDate
=
7
;
}
return
weekDate
;
}
/**
* 得到当天星期几,用(1234567)表示
* @param handleDate 传入日期
* @return
* int
*/
@SuppressWarnings
(
"deprecation"
)
public
static
int
getWeekDate
(
Date
handleDate
)
{
int
weekDate
=
handleDate
.
getDay
();
if
(
weekDate
==
0
)
{
weekDate
=
7
;
}
return
weekDate
;
}
/***
* 比较两个时间相差的分钟数。
*
* @param:firstTime 比较小的时间 secondTime 比较大的时间
* @return:Integer :分钟数
* */
public
static
Long
compare
(
Date
firstTime
,
Date
secondTime
)
{
Long
minutes
=
(
secondTime
.
getTime
()
-
firstTime
.
getTime
())
/
(
1000
*
60
);
return
minutes
;
}
/**
* 比较两个时间相差的天数
* @param firstTime
* @param secondTime
* @return
* Long
*/
public
static
Long
compareOfDay
(
Date
firstTime
,
Date
secondTime
)
{
Long
days
=
(
secondTime
.
getTime
()
-
firstTime
.
getTime
())
/
(
1000
*
60
*
60
*
24
);
return
days
;
}
/**
* 获取当前日期所在的星期几
*
* @param currentDate
* @since 1.0.0
*/
public
static
int
getDayOfWeek
(
Date
currentDate
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
currentDate
);
// 获取当天所在的星期
int
dayOfWeek
=
cal
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
;
// 处理周日
if
(
dayOfWeek
==
0
)
{
dayOfWeek
=
7
;
}
return
dayOfWeek
;
}
@SuppressWarnings
(
"static-access"
)
public
static
String
getDayOfWeekInfo
(
int
i
)
{
String
result
=
""
;
switch
(
i
)
{
case
1
:
result
=
"星期一"
;
break
;
case
2
:
result
=
"星期二"
;
break
;
case
3
:
result
=
"星期三"
;
break
;
case
4
:
result
=
"星期四"
;
break
;
case
5
:
result
=
"星期五"
;
break
;
case
6
:
result
=
"星期六"
;
break
;
default
:
result
=
"星期日"
;
break
;
}
return
result
;
}
}
src/main/java/cn/com/uitech/authorization/utils/ProductExportUtils.java
View file @
c4d2be67
...
...
@@ -12,6 +12,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import
org.apache.poi.ss.util.CellRangeAddressList
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFDataValidation
;
import
org.springframework.util.ObjectUtils
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
...
...
@@ -277,7 +278,7 @@ public class ProductExportUtils {
* @param list 表中元素
* @return
*/
public
static
SXSSFWorkbook
getSXSSFWorkbook
(
String
sheetName
,
ArrayList
<
String
>
titList
,
List
<
String
[]>
list
){
public
static
SXSSFWorkbook
getSXSSFWorkbook
(
String
sheetName
,
ArrayList
<
String
>
titList
,
List
<
String
[]>
list
,
Integer
temp
){
//创建一个HSSFWorkbook,对应一个Excel文件
SXSSFWorkbook
sxssfWorkbook
=
new
SXSSFWorkbook
();
//在workbook中添加一个sheet,对应Excel文件中的sheet
...
...
@@ -288,13 +289,20 @@ public class ProductExportUtils {
long
timeInMillis
=
Calendar
.
getInstance
().
getTimeInMillis
();
if
(!
ObjectUtils
.
isEmpty
(
temp
)){
if
(
temp
==
1
){
//给可卖可见增加下拉效果
String
[]
status
=
new
String
[]{
"可卖"
,
"不可卖"
};
String
[]
visible
=
new
String
[]{
"PM可见"
,
"全部可见"
,
"隐藏"
};
String
[]
status
=
new
String
[]{
"是"
,
"否"
};
DataValidation
dataValidation
=
getDataValidation
(
sheet
,
status
,
1
,
list
.
size
(),
5
);
DataValidation
dataValidation1
=
getDataValidation
(
sheet
,
visible
,
1
,
list
.
size
(),
6
);
sheet
.
addValidationData
(
dataValidation
);
sheet
.
addValidationData
(
dataValidation1
);
}
else
if
(
temp
==
2
){
//给可卖可见增加下拉效果
String
[]
status
=
new
String
[]{
"可卖"
,
"不可卖"
};
DataValidation
dataValidation
=
getDataValidation
(
sheet
,
status
,
1
,
list
.
size
(),
6
);
sheet
.
addValidationData
(
dataValidation
);
}
}
//产生表头
Row
row1
=
sheet
.
createRow
(
0
);
...
...
src/main/resources/mapper/CharacteristicMapper.xml
View file @
c4d2be67
...
...
@@ -233,4 +233,40 @@
<select
id=
"getCharacteristicInfo"
resultType=
"java.lang.Integer"
>
select is_h3c isH3C from super_characteristic_info where characteristic_Code = #{characteristicCode} and super_bom_code = #{superBomCode}
</select>
<select
id=
"exportCharacteristic"
resultType=
"cn.com.uitech.authorization.pojo.dto.CharacteristicExportDto"
>
select
sort,
a.super_bom_code as superBomCode,
characteristic_code as characteristicCode,
characteristic_name as characteristicName,
unis_sales_c_name as unisSalesCName,
case when is_h3c = 0
then '否'
else '是'
end as isH3C
from
super_characteristic_info a
left join super_bom_info b on a.super_bom_code = b.super_bom_code
<where>
<if
test=
"superBomCode!='' and superBomCode != null"
>
a.super_bom_code = #{superBomCode}
</if>
<if
test=
"productClassCode!=null and productClassCode!=''"
>
AND b.product_class_code=#{productClassCode}
</if>
<if
test=
"brand!=null and brand!=''"
>
AND b.brand=#{brand}
</if>
<if
test=
"characteristicCode!=null and characteristicCode!=''"
>
AND a.characteristic_code=#{characteristicCode}
</if>
</where>
order by sort asc
</select>
<update
id=
"updateCharacteristicInfo"
>
update super_characteristic_info set is_h3c = #{isH3C} , unis_sales_c_name = #{unisSalesCName} , sort = #{sort}
where super_bom_code = #{superBomCode} and characteristic_Code = #{characteristicCode}
</update>
</mapper>
src/main/resources/mapper/CharacteristicValueMapper.xml
View file @
c4d2be67
...
...
@@ -162,53 +162,44 @@
<select
id=
"exportCharacteristicValue"
parameterType=
"cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto"
resultType=
"cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto"
>
SELECT *
FROM (
SELECT
c.super_bom_NAME AS "bomName",
a.Characteristic_Value_Code as CharacteristicValueCode,
c.super_bom_Code as superBomCode,
c.product_class_code as productClassCode,
d.product_class_name as productClassName,
case when a.is_sate=1 then '可卖'
else '不可卖' end as "isStatus",
case when a.isShow=1 then '全部可见'
when a.isShow=2 then 'PM可见'
when a.isShow=3 then '隐藏'
end as "isShow",
case when c.is_state=1 then '可卖'
else '不可卖' end as "bomStatus",
a.characteristic_value_name as characteristicValueName,
b.characteristic_name as characteristicName
FROM super_characteristic_value_info a
LEFT JOIN super_characteristic_info b ON a.Characteristic_Code=b.Characteristic_Code
LEFT JOIN super_bom_info c ON characteristic.BOMCode=configurablebom.BOMCode
LEFT JOIN a_productclasscode d on d.product_class_code=c.product_class_code
SELECT DISTINCT
a.super_bom_code as superBomCode,
a.Characteristic_Code as CharacteristicCode,
b.unis_Sales_C_Name as CharacteristicName,
A.Characteristic_Value_Code AS CharacteristicValueCode,
A.Characteristic_Value_name AS CharacteristicValueName,
A.unis_Sales_V_Name AS unisSalesVName,
CASE
WHEN A.is_state = 1 THEN
'可卖' ELSE'不可卖'
END AS "isState",
A.zph_Code AS zphCode,
A.zph_Name AS zphName,
A.qualify_Date AS qualifyDate,
A.h3c_C_Value AS h3cCValue,
b.sort
FROM
super_characteristic_value_info
A LEFT JOIN super_characteristic_info b ON A.Characteristic_Code = b.Characteristic_Code
LEFT JOIN super_bom_info C ON b.super_BOM_Code = c.super_BOM_Code
<where>
1=1
<if
test=
"productClassCode!=null and productClassCode!=''"
>
AND
c.Product_class_Code=#{productClassCode}
c.Product_class_Code=#{productClassCode}
</if>
<if
test=
"characteristicCode!=null and characteristicCode!=''"
>
and a.Characteristic_Code=#{characteristicCode}
</if>
<if
test=
"characteristicValueCode!=null and characteristicValueCode!=''"
>
and a.Characteristic_Value_Code
like CONCAT('%','${characteristicValueCode}','%')
and a.Characteristic_Value_Code
= #{characteristicValueCode}
</if>
<if
test=
"superBomCode!=null and superBomCode!=''"
>
and
c
.super_bom_code=#{superBomCode}
and
a
.super_bom_code=#{superBomCode}
</if>
<if
test=
"characteristicValueName!=null and characteristicValueName!=''"
>
and a.characteristic_value_name like CONCAT('%','${characteristicValueName}','%')
</if>
<if
test=
"bomStatus!=null"
>
and c.is_state=#{bomStatus}
</if>
<if
test=
"status!=null"
>
and a.is_state=#{status}
<if
test=
"brand!=null and brand!=''"
>
and c.brand = #{brand}
</if>
</where>
)a
order by b.sort asc
</select>
...
...
@@ -346,4 +337,9 @@
where h3c_c_value = #{h3cVCode}
and super_bom_code = #{h3cPn}
</select>
<update
id=
"updateCharacteristicValue"
>
update super_characteristic_value_info set unis_sales_v_name = #{unisSalesVName},h3c_c_value = #{h3cCValue}, h3c_Deliver_Code = #{h3cDeliverCode}
where super_bom_code = #{superBomCode} and characteristic_Code = #{characteristicCode} and characteristic_Value_Code = #{characteristicValueCode}
</update>
</mapper>
src/main/resources/mapper/SuperBomPriceCalculateMapper.xml
View file @
c4d2be67
...
...
@@ -136,4 +136,70 @@
</if>
</where>
</select>
<select
id=
"exportCharacteristicValuePrice"
resultType=
"cn.com.uitech.authorization.pojo.dto.SuperCharacterPriceInfoDto"
>
select a.super_bom_name as superBomName,
a.super_bom_code as superBomCode,
b.characteristic_code AS characterCode,
b.characteristic_name AS characterName,
c.characteristic_value_name AS characterValueName,
c.characteristic_value_code AS characterValueCode,
case when d.price_type = 1
then '成本定价法'
else '市场定价法'
end as priceType,
e.actual_price AS actualPrice,
e.leve0_price AS leve0Price,
e.leve1_price AS leve1Price,
e.leve2_price AS leve2Price,
e.leve3_price AS leve3Price,
e.leve4_price AS leve4Price,
e.agent_price AS agentprice,
b.sort
from super_bom_info a
inner join super_characteristic_info b
on a.super_bom_code = b.super_bom_code
inner join super_characteristic_value_info c
on a.super_bom_code = c.super_bom_code and b.characteristic_code = c.characteristic_code
-- 查系数
inner join basics_price_info d on a.super_bom_code = d.super_bom_code
and a.brand = d.brand
and a.product_class_code = d.product_class_code
left join super_character_price_info e on a.super_bom_code = e.super_bom_code
and b.characteristic_code = e.character_code and c.characteristic_value_code = e.character_value_code
<where>
<if
test=
"superBomCode != null and superBomCode != ''.toString()"
>
a.super_bom_code = #{superBomCode}
</if>
<if
test=
"characteristicValueCode != null and characteristicValueCode != ''.toString()"
>
and c.characteristic_value_code like CONCAT('%','${characteristicValueCode}','%')
</if>
<if
test=
"characteristicCode != null and characteristicCode != ''.toString()"
>
and b.characteristic_code = #{characteristicCode}
</if>
<if
test=
"brand != null and brand != ''.toString()"
>
and a.brand = #{brand}
</if>
<if
test=
"productClassCode != null and productClassCode != ''.toString()"
>
and a.product_class_code = #{productClassCode}
</if>
</where>
order by b.sort asc
</select>
<update
id=
"updateCharacteristicInfo"
>
update super_character_price_info set
agent_Price = #{agentPrice} ,
actual_Price = #{actualPrice} ,
leve0_price =#{leve0Price},
leve1_price = #{leve1Price},
leve2_price = #{leve2Price},
leve3_price = #{leve3Price},
leve4_price = #{leve4Price},
update_time = now()
where super_bom_code = #{superBomCode}
and character_Code = #{characteristicCode}
and character_Value_Code = #{characteristicValueCode}
</update>
</mapper>
src/main/resources/mapper/TempMapper.xml
View file @
c4d2be67
...
...
@@ -21,12 +21,16 @@
<result
property=
"characteristicValueName"
column=
"characteristic_value_name"
/>
</collection>
</resultMap>
<select
id=
"getTempList"
result
Map=
"DeployTempMap
"
>
select * from deploy_temp
a left join deploy_temp_item b on a.old_sku_code = b.old_sku_code
where
a.status = '未开始'
<select
id=
"getTempList"
result
Type=
"cn.com.uitech.authorization.pojo.dto.DeployTempParam
"
>
select * from deploy_temp
where
status = '未开始' limit 1
</select>
<update
id=
"updateTemp"
>
update deploy_temp set description = #{description} , status = #{status} where old_sku_code = #{oldSkuCode}
</update>
<select
id=
"getTempListBySkuCode"
resultType=
"cn.com.uitech.authorization.pojo.dto.DeployTempItemParam"
>
select * from deploy_temp_item where old_sku_code = #{oldSkuCode}
</select>
</mapper>
\ No newline at end of file
src/main/resources/mapper/UserInfoMapper.xml
View file @
c4d2be67
...
...
@@ -4,7 +4,7 @@
<mapper
namespace=
"cn.com.uitech.authorization.mapper.UserInfoMapper"
>
<select
id=
"getUser"
resultType=
"cn.com.uitech.authorization.pojo.entity.UserInfo"
>
select * from user_info where user_code = #{userCode} and pass_word = #{pass
W
ord}
select * from user_info where user_code = #{userCode} and pass_word = #{pass
w
ord}
</select>
<select
id=
"getUserDimension"
resultType=
"cn.com.uitech.authorization.pojo.entity.MenuInfo"
>
...
...
@@ -15,7 +15,7 @@
user_menu_info
A LEFT JOIN menu_info b ON A.menu_id = b.menu_id
WHERE
A.user_code = #{userCode}
upper(A.user_code) = upper(#{userCode})
</select>
<select
id=
"getUserOne"
resultType=
"cn.com.uitech.authorization.pojo.entity.UserInfo"
>
...
...
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