Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
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
zhangkb
indicators
Commits
56646b51
Commit
56646b51
authored
Feb 27, 2023
by
dengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权重数据填报功能
parent
2b585dc7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
851 additions
and
1 deletion
+851
-1
WeightDataEnterCtrl.java
...ymobile/indicators/api/hytobacco/WeightDataEnterCtrl.java
+0
-0
WeightExcelTempCtrl.java
...ymobile/indicators/api/hytobacco/WeightExcelTempCtrl.java
+0
-0
Constants.java
...ain/java/com/keymobile/indicators/constant/Constants.java
+2
-0
ObjScoreIndWeightDetail.java
...dicators/model/entity/weight/ObjScoreIndWeightDetail.java
+70
-0
WeightExcelIndicator.java
.../indicators/model/entity/weight/WeightExcelIndicator.java
+54
-0
WeightExcelObj.java
...mobile/indicators/model/entity/weight/WeightExcelObj.java
+49
-0
WeightExcelTemplate.java
...e/indicators/model/entity/weight/WeightExcelTemplate.java
+58
-0
WeightIndValue.java
...mobile/indicators/model/entity/weight/WeightIndValue.java
+78
-0
ObjScoreIndWeightDetailMapper.java
...rs/model/mapper/weight/ObjScoreIndWeightDetailMapper.java
+25
-0
WeightExcelIndicatorMapper.java
...ators/model/mapper/weight/WeightExcelIndicatorMapper.java
+25
-0
WeightExcelObjMapper.java
.../indicators/model/mapper/weight/WeightExcelObjMapper.java
+25
-0
WeightExcelTemplateMapper.java
...cators/model/mapper/weight/WeightExcelTemplateMapper.java
+28
-0
WeightIndValueMapper.java
.../indicators/model/mapper/weight/WeightIndValueMapper.java
+38
-0
ObjScoreIndWeightCfgServiceImpl.java
...icators/service/impl/ObjScoreIndWeightCfgServiceImpl.java
+35
-0
WeightExcelTemplateService.java
...s/service/weightDataEnter/WeightExcelTemplateService.java
+12
-0
WeightIndValueService.java
...cators/service/weightDataEnter/WeightIndValueService.java
+13
-0
WeightExcelTemplateServiceImpl.java
.../weightDataEnter/impl/WeightExcelTemplateServiceImpl.java
+118
-0
WeightIndValueServiceImpl.java
...rvice/weightDataEnter/impl/WeightIndValueServiceImpl.java
+96
-0
ModelPathEnum.java
...in/java/com/keymobile/indicators/utils/ModelPathEnum.java
+2
-1
ObjScoreIndWeightDetailMapper.xml
...sources/mybatis/mapping/ObjScoreIndWeightDetailMapper.xml
+23
-0
WeightExcelIndicatorMapper.xml
.../resources/mybatis/mapping/WeightExcelIndicatorMapper.xml
+20
-0
WeightExcelObjMapper.xml
src/main/resources/mybatis/mapping/WeightExcelObjMapper.xml
+20
-0
WeightExcelTemplateMapper.xml
...n/resources/mybatis/mapping/WeightExcelTemplateMapper.xml
+24
-0
WeightIndValueMapper.xml
src/main/resources/mybatis/mapping/WeightIndValueMapper.xml
+36
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/WeightDataEnterCtrl.java
0 → 100644
View file @
56646b51
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/indicators/api/hytobacco/WeightExcelTempCtrl.java
0 → 100644
View file @
56646b51
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/indicators/constant/Constants.java
View file @
56646b51
...
...
@@ -60,6 +60,8 @@ public class Constants {
*/
public
static
final
String
LOG_INDICATOR_WEIGHTCFG_API
=
"indicator.weightcfg"
;
public
static
final
String
LOG_INDICATOR_WEIGHT_DATA_ENTER_API
=
"indicator.weightdataenter"
;
/**
*短板管理结果汇总
**/
...
...
src/main/java/com/keymobile/indicators/model/entity/weight/ObjScoreIndWeightDetail.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
/**
* @author DW
* @date 2023-02-26-0026 16:07
* @description 对标主体得分指标权重明细表
*/
@Data
@Table
(
name
=
"obj_score_ind_weight_detail"
)
public
class
ObjScoreIndWeightDetail
{
// 表主键ID有问题
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
// 配置主表ID
private
Integer
cfgId
;
// 租户组织CODE,区分不同单位
private
String
code
;
// 配置级别
private
String
levelName
;
// 配置周期
private
String
dataValue
;
// 对标主体CODE
private
String
orgNo
;
// 对标主体name
private
String
orgName
;
// 对标主体类型-两烟区-纯销区
private
String
orgType
;
// 指标ID
private
String
indId
;
// 指标名称
private
String
indName
;
// 权重
private
BigDecimal
weight
;
// 指标综合评价权重
private
BigDecimal
indWeight
;
// 指标改善提升权重
private
BigDecimal
indImproveWeight
;
// 两烟区大类权重
private
BigDecimal
weightTwo
;
// 纯销区大类权重
private
BigDecimal
weightOne
;
// 大类权重
private
BigDecimal
bigWeight
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightExcelIndicator.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* @author DW
* @date 2023-02-23-0023 15:10
* @description
*/
@Data
@Table
(
name
=
"weight_data_excel_ind"
)
public
class
WeightExcelIndicator
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 关联模板id
*/
private
Integer
tempId
;
/**
* 关联指标id
*/
private
String
indId
;
/**
* 指标名称
*/
private
String
indName
;
/**
* 指标单位
*/
private
String
indUnit
;
/**
* 指标数量来源:1 Excel导入 2 手工录入
*/
private
Integer
indSource
;
/**
* 顺序号
*/
private
Integer
orderNum
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightExcelObj.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* @author DW
* @date 2023-02-23-0023 15:11
* @description
*/
@Data
@Table
(
name
=
"weight_data_excel_obj"
)
public
class
WeightExcelObj
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 关联模板id
*/
private
Integer
tempId
;
/**
* 对象id
*/
private
String
objId
;
/**
* 对象名
*/
private
String
objName
;
/**
* 对象类型:1、组织 2、人员 3、数据项
*/
private
Integer
objType
;
/**
* 顺序号
*/
private
Integer
orderNum
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightExcelTemplate.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
java.util.List
;
/**
* @author DW
* @date 2023-02-23-0023 15:09
* @description
*/
@Data
@Table
(
name
=
"weight_data_excel_temp"
)
@ApiModel
(
"excel模板定义"
)
public
class
WeightExcelTemplate
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
@ApiModelProperty
(
"权重ID"
)
private
Integer
weightId
;
/**
* 模板名字
*/
@ApiModelProperty
(
"模板名字"
)
private
String
name
;
/**
* 列类型
*/
@ApiModelProperty
(
"列类型:1、指标 2 考核对象"
)
private
Integer
ctype
;
/**
* 所属组织机构
*/
@ApiModelProperty
(
"所属组织机构"
)
private
String
orgNo
;
@ApiModelProperty
(
"数据项列表"
)
@Transient
private
List
<
WeightExcelIndicator
>
inds
;
@ApiModelProperty
(
"考核对象列表"
)
@Transient
private
List
<
WeightExcelObj
>
objs
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightIndValue.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
/**
* @author DW
* @date 2023-02-22-0022 15:35
* @description 权重指标数据实体-用于权重配置中在线填报功能使用
*/
@Data
@Table
(
name
=
"weight_ind_value"
)
public
class
WeightIndValue
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
// 权重配置ID
private
Integer
weightId
;
// 考核指标ID
private
String
indId
;
// 考核指标名称
private
String
indName
;
// 考核指标单位
private
String
indUnit
;
/**
* 指标数量来源:1 Excel导入 2 手工录入
*/
private
Integer
indSource
;
// 综合评价权重
private
BigDecimal
synthesizeWeight
;
// 改善提升权重
private
BigDecimal
improveWeight
;
// 维度权重
private
BigDecimal
dimensionWeight
;
/**
* 数据对象id
*/
@ApiModelProperty
(
"数据对象id"
)
private
String
objId
;
/**
* 数据对象类型:1、组织机构 2、人员
*/
@ApiModelProperty
(
"数据对象类型:1、组织机构 2、人员 3、岗位"
)
private
Integer
objType
;
/**
* 数据项对象名称
*/
@ApiModelProperty
(
"数据对象名称"
)
private
String
objName
;
@ApiModelProperty
(
"备注"
)
private
String
description
;
/**
* excel导入对应的excel模板id
*/
private
Integer
tempId
;
}
src/main/java/com/keymobile/indicators/model/mapper/weight/ObjScoreIndWeightDetailMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.ObjScoreIndWeightDetail
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
ObjScoreIndWeightDetailMapper
extends
BaseMapper
<
ObjScoreIndWeightDetail
>
{
/**
* 批量插入填报值
* @param valueList
*/
void
batchInsert
(
@Param
(
"valueList"
)
List
<
ObjScoreIndWeightDetail
>
valueList
);
/**
* 根据权重配置ID删除权重数据填报
* @param cfgId 权重配置ID
*/
void
deleteByCfgId
(
@Param
(
"cfgId"
)
Integer
cfgId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelIndicatorMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
org.apache.ibatis.annotations.Mapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
WeightExcelIndicatorMapper
extends
BaseMapper
<
WeightExcelIndicator
>
{
/**
* 查询模板关联的指标信息
* @param tempId
* @return
*/
List
<
WeightExcelIndicator
>
getByTempId
(
Integer
tempId
);
/**
* 根据模板id删除指标信息
* @param tempId
*/
void
deleteByTempId
(
Integer
tempId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelObjMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
org.apache.ibatis.annotations.Mapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
WeightExcelObjMapper
extends
BaseMapper
<
WeightExcelObj
>
{
/**
* 查询模板关联的考核对象信息
* @param tempId
* @return
*/
List
<
WeightExcelObj
>
getByTempId
(
Integer
tempId
);
/**
* 根据模板id删除考核对象信息
* @param tempId
*/
void
deleteByTempId
(
Integer
tempId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelTemplateMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
import
org.apache.ibatis.annotations.Mapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
@Mapper
public
interface
WeightExcelTemplateMapper
extends
BaseMapper
<
WeightExcelTemplate
>
{
/**
* 逻辑删除模板
* @param id
*/
void
deleteById
(
Integer
id
);
/**
* 根据权重id获取excel模板
* @param weightId
* @return
*/
WeightExcelTemplate
getByWeightId
(
Integer
weightId
);
/**
* 根据权重ID删除权重模板
* @param weightId 权重ID
*/
void
deleteByWeightId
(
Integer
weightId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightIndValueMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
WeightIndValueMapper
extends
BaseMapper
<
WeightIndValue
>
{
/**
* 批量插入填报值
* @param valueList
*/
void
batchInsert
(
@Param
(
"valueList"
)
List
<
WeightIndValue
>
valueList
);
/**
* 根据 指标id 机构编码 时间维度删除
* @param newValues
**/
void
batchDelete
(
@Param
(
"newValues"
)
List
<
WeightIndValue
>
newValues
);
/**
* 根据权重配置ID删除权重数据填报
* @param weightId 权重配置ID
*/
void
deleteByWeightId
(
@Param
(
"weightId"
)
Integer
weightId
);
/**
* 根据权重配置ID查询权重数据填报
* @param weightId 权重配置ID
* @return 权重数据填报集合
*/
List
<
WeightIndValue
>
findByWeightId
(
@Param
(
"weightId"
)
Integer
weightId
);
}
src/main/java/com/keymobile/indicators/service/impl/ObjScoreIndWeightCfgServiceImpl.java
View file @
56646b51
...
...
@@ -2,11 +2,16 @@ package com.keymobile.indicators.service.impl;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper
;
import
com.keymobile.indicators.service.ObjScoreIndWeightCfgService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleGroupObjService
;
import
com.keymobile.indicators.service.weightDataEnter.WeightIndValueService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -34,6 +39,12 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
private
ObjScoreIndWeightCfgMapper
weightCfgMapper
;
@Autowired
private
DriveIndDefMapper
driveIndDefMapper
;
@Autowired
private
WeightIndValueMapper
weightIndValueMapper
;
@Autowired
private
TaskRuleGroupObjService
taskRuleGroupObjService
;
@Autowired
private
WeightIndValueService
weightIndValueService
;
@Override
public
void
deleteById
(
Integer
id
)
{
...
...
@@ -82,6 +93,30 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
public
void
updateWeight
(
ObjScoreIndWeightCfg
weightCfg
)
{
weightCfg
.
setState
(
Constants
.
DATA_STATE_A
);
weightCfgMapper
.
updateByPrimaryKey
(
setIndMsg
(
weightCfg
));
updateWeightIndValue
(
weightCfg
);
}
/**
* 根据权重配置更新数据填报结果表
* @param weightCfg 权重配置信息
*/
private
void
updateWeightIndValue
(
ObjScoreIndWeightCfg
weightCfg
)
{
List
<
WeightIndValue
>
values
=
weightIndValueMapper
.
findByWeightId
(
weightCfg
.
getId
());
// 判断权重是否已经填报过数据,没有填报过数据的权重无需此操作
// 填报过的权重配置需要同步更新维度权重
if
(
values
!=
null
&&
values
.
size
()
>
0
)
{
// 获取两烟区单位
// 两烟区单位
TaskRuleGroupObj
twoGroupObj
=
taskRuleGroupObjService
.
getById
(
weightCfg
.
getWeightTwoUnit
());
for
(
WeightIndValue
value
:
values
)
{
if
(
StringUtils
.
contains
(
twoGroupObj
.
getDetailNames
(),
value
.
getObjName
()))
{
value
.
setDimensionWeight
(
weightCfg
.
getWeightTwo
());
}
else
{
value
.
setDimensionWeight
(
weightCfg
.
getWeightOne
());
}
}
weightIndValueService
.
saveWeightValues
(
values
,
weightCfg
.
getId
());
}
}
/**
...
...
src/main/java/com/keymobile/indicators/service/weightDataEnter/WeightExcelTemplateService.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
public
interface
WeightExcelTemplateService
{
WeightExcelTemplate
getByWeightId
(
String
weightId
);
WeightExcelTemplate
getById
(
Integer
id
);
void
create
(
WeightExcelTemplate
template
);
}
src/main/java/com/keymobile/indicators/service/weightDataEnter/WeightIndValueService.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
java.util.List
;
public
interface
WeightIndValueService
{
void
saveWeightValues
(
List
<
WeightIndValue
>
values
,
Integer
weightId
);
List
<
WeightIndValue
>
findByWeightId
(
Integer
weightId
);
}
src/main/java/com/keymobile/indicators/service/weightDataEnter/impl/WeightExcelTemplateServiceImpl.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
.
impl
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelIndicator
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelObj
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelTemplate
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelIndicatorMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelObjMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelTemplateMapper
;
import
com.keymobile.indicators.service.weightDataEnter.WeightExcelTemplateService
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author DW
* @date 2023-02-23-0023 15:31
* @description
*/
@Service
public
class
WeightExcelTemplateServiceImpl
implements
WeightExcelTemplateService
{
@Autowired
private
WeightExcelIndicatorMapper
excelIndicatorMapper
;
@Autowired
private
WeightExcelObjMapper
excelObjMapper
;
@Autowired
private
WeightExcelTemplateMapper
excelTemplateMapper
;
@Override
public
WeightExcelTemplate
getByWeightId
(
String
weightId
)
{
WeightExcelTemplate
template
=
excelTemplateMapper
.
getByWeightId
(
Integer
.
parseInt
(
weightId
));
if
(
template
!=
null
)
{
List
<
WeightExcelObj
>
objs
=
excelObjMapper
.
getByTempId
(
template
.
getId
());
List
<
WeightExcelIndicator
>
inds
=
excelIndicatorMapper
.
getByTempId
(
template
.
getId
());
template
.
setObjs
(
objs
);
template
.
setInds
(
inds
);
}
return
template
;
}
@Override
public
WeightExcelTemplate
getById
(
Integer
id
)
{
WeightExcelTemplate
template
=
excelTemplateMapper
.
selectByPrimaryKey
(
id
);
if
(
template
!=
null
)
{
List
<
WeightExcelObj
>
objs
=
excelObjMapper
.
getByTempId
(
id
);
List
<
WeightExcelIndicator
>
inds
=
excelIndicatorMapper
.
getByTempId
(
id
);
template
.
setObjs
(
objs
);
template
.
setInds
(
inds
);
}
return
template
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
WeightExcelTemplate
template
)
{
// 需要保证weight_data_excel_temp表中weight_id关联的数据唯一
// 先删除(将表数据state修改为3-废弃),再添加
excelTemplateMapper
.
deleteByWeightId
(
template
.
getWeightId
());
Date
now
=
new
Date
();
String
currentUserId
=
SystemUserUtil
.
getCurrentUserId
();
template
.
setUpdater
(
currentUserId
);
template
.
setCreator
(
currentUserId
);
template
.
setUpdateTime
(
now
);
template
.
setCreateTime
(
now
);
template
.
setState
(
Constants
.
DATA_STATE_A
);
excelTemplateMapper
.
insert
(
template
);
insertIndAndObj
(
template
,
now
,
currentUserId
);
}
/**
* 插入指标和对象信息
* @param template
* @param now
* @param currentUserId
*/
private
void
insertIndAndObj
(
WeightExcelTemplate
template
,
Date
now
,
String
currentUserId
)
{
List
<
WeightExcelObj
>
objs
=
template
.
getObjs
();
if
(
CollectionUtils
.
isNotEmpty
(
objs
))
{
int
o
=
1
;
for
(
WeightExcelObj
obj
:
objs
)
{
obj
.
setId
(
null
);
obj
.
setTempId
(
template
.
getId
());
obj
.
setUpdater
(
currentUserId
);
obj
.
setCreator
(
currentUserId
);
obj
.
setUpdateTime
(
now
);
obj
.
setOrderNum
(
o
++);
obj
.
setCreateTime
(
now
);
obj
.
setState
(
Constants
.
DATA_STATE_A
);
excelObjMapper
.
insert
(
obj
);
}
}
List
<
WeightExcelIndicator
>
inds
=
template
.
getInds
();
if
(
CollectionUtils
.
isNotEmpty
(
inds
))
{
int
o
=
1
;
for
(
WeightExcelIndicator
indicator
:
inds
)
{
indicator
.
setId
(
null
);
indicator
.
setUpdater
(
currentUserId
);
indicator
.
setCreator
(
currentUserId
);
indicator
.
setUpdateTime
(
now
);
indicator
.
setCreateTime
(
now
);
indicator
.
setOrderNum
(
o
++);
indicator
.
setState
(
Constants
.
DATA_STATE_A
);
indicator
.
setTempId
(
template
.
getId
());
indicator
.
setIndSource
(
1
);
excelIndicatorMapper
.
insert
(
indicator
);
}
}
}
}
src/main/java/com/keymobile/indicators/service/weightDataEnter/impl/WeightIndValueServiceImpl.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
.
impl
;
import
com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.weight.ObjScoreIndWeightDetail
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper
;
import
com.keymobile.indicators.model.mapper.weight.ObjScoreIndWeightDetailMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper
;
import
com.keymobile.indicators.service.weightDataEnter.WeightIndValueService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author DW
* @date 2023-02-22-0022 18:13
* @description
*/
@Service
@Slf4j
public
class
WeightIndValueServiceImpl
implements
WeightIndValueService
{
@Autowired
private
WeightIndValueMapper
weightIndValueMapper
;
@Autowired
private
ObjScoreIndWeightDetailMapper
weightDetailMapper
;
@Autowired
private
ObjScoreIndWeightCfgMapper
weightCfgMapper
;
@Autowired
private
DriveIndDefMapper
driveIndDefMapper
;
@Override
public
void
saveWeightValues
(
List
<
WeightIndValue
>
values
,
Integer
weightId
)
{
log
.
info
(
weightId
+
",正在批量清楚历史数据。。。"
);
weightIndValueMapper
.
deleteByWeightId
(
weightId
);
log
.
info
(
weightId
+
",保存excel数据。。。"
);
weightIndValueMapper
.
batchInsert
(
values
);
// 同时将权重结果数据填充到obj_score_ind_weight_detail表中
saveDetail
(
values
,
weightId
);
}
/**
* 将权重结果数据填充到obj_score_ind_weight_detail表中
* @param values
* @param weightId
*/
private
void
saveDetail
(
List
<
WeightIndValue
>
values
,
Integer
weightId
)
{
ObjScoreIndWeightCfg
weightCfg
=
weightCfgMapper
.
getById
(
weightId
);
// 先清除表里面的数据
weightDetailMapper
.
deleteByCfgId
(
weightId
);
List
<
ObjScoreIndWeightDetail
>
details
=
new
ArrayList
<>();
for
(
WeightIndValue
indValue
:
values
)
{
DriveIndDef
indDef
=
driveIndDefMapper
.
selectByPrimaryKey
(
indValue
.
getIndId
());
ObjScoreIndWeightDetail
weightDetail
=
new
ObjScoreIndWeightDetail
();
weightDetail
.
setCfgId
(
weightId
);
weightDetail
.
setCode
(
weightCfg
.
getOrgNo
());
weightDetail
.
setLevelName
(
weightCfg
.
getLevelName
());
weightDetail
.
setDataValue
(
weightCfg
.
getDateValue
());
weightDetail
.
setOrgNo
(
indValue
.
getObjId
());
weightDetail
.
setOrgName
(
indValue
.
getObjName
());
weightDetail
.
setIndId
(
indValue
.
getIndId
());
weightDetail
.
setIndName
(
indValue
.
getIndName
());
if
(
StringUtils
.
isNotBlank
(
indDef
.
getComprehensiveEvaluation
()))
{
weightDetail
.
setWeight
(
new
BigDecimal
(
indDef
.
getComprehensiveEvaluation
()));
}
else
{
weightDetail
.
setWeight
(
new
BigDecimal
(
0
));
}
weightDetail
.
setIndWeight
(
indValue
.
getSynthesizeWeight
());
weightDetail
.
setIndImproveWeight
(
indValue
.
getImproveWeight
());
weightDetail
.
setWeightTwo
(
weightCfg
.
getWeightTwo
());
weightDetail
.
setWeightOne
(
weightCfg
.
getWeightOne
());
if
(
weightCfg
.
getWeightTwo
().
equals
(
indValue
.
getDimensionWeight
()))
{
weightDetail
.
setOrgType
(
"两烟区"
);
}
else
{
weightDetail
.
setOrgType
(
"纯销区"
);
}
weightDetail
.
setBigWeight
(
indValue
.
getDimensionWeight
());
details
.
add
(
weightDetail
);
}
weightDetailMapper
.
batchInsert
(
details
);
}
@Override
public
List
<
WeightIndValue
>
findByWeightId
(
Integer
weightId
)
{
return
weightIndValueMapper
.
findByWeightId
(
weightId
);
}
}
src/main/java/com/keymobile/indicators/utils/ModelPathEnum.java
View file @
56646b51
...
...
@@ -25,7 +25,8 @@ public enum ModelPathEnum {
LOG_INDICATOR_CONFIG_INFO
(
"indicator.config.info"
,
"系统管理/配置项管理"
),
LOG_INDICATOR_LOG
(
"indicator.log"
,
"系统管理/操作日志"
),
LOG_INDICATOR_AUDIT_ROLE_API
(
"indicator.audit.role"
,
"系统管理/填报审核角色配置管理 "
),
LOG_INDICATOR_WEIGHTCFG_API
(
"indicator.weightcfg"
,
"数据填报/权重配置"
);
LOG_INDICATOR_WEIGHTCFG_API
(
"indicator.weightcfg"
,
"数据填报/权重配置"
),
LOG_INDICATOR_WEIGHT_DATA_ENTER_API
(
"indicator.weightdataenter"
,
"数据填报/权重配置-数据填报"
);
private
String
modelName
;
private
String
modelPath
;
...
...
src/main/resources/mybatis/mapping/ObjScoreIndWeightDetailMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.ObjScoreIndWeightDetailMapper"
>
<insert
id=
"batchInsert"
parameterType=
"list"
>
insert into obj_score_ind_weight_detail
(cfg_id, code, level_name, date_value, org_no, org_name, org_type, ind_id, ind_name, weight, ind_weight, ind_improve_weight,
weight_two, weight_one , big_weight)
values
<foreach
collection=
"valueList"
item=
"val"
separator=
","
>
(#{val.cfgId}, #{val.code}, #{val.levelName}, #{val.dataValue}, #{val.orgNo}, #{val.orgName}, #{val.orgType},
#{val.indId}, #{val.indName}, #{val.weight}, #{val.indWeight}, #{val.indImproveWeight},
#{val.weightTwo}, #{val.weightOne}, #{val.bigWeight})
</foreach>
</insert>
<delete
id=
"deleteByCfgId"
parameterType=
"java.lang.Integer"
>
delete from obj_score_ind_weight_detail where cfg_id = #{cfgId}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelIndicatorMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightExcelIndicatorMapper"
>
<select
id=
"getByTempId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightExcelIndicator"
>
select *
from weight_data_excel_ind
where temp_id = #{tempId} and state = 1
order by order_num asc
</select>
<delete
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
delete
from weight_data_excel_ind
where temp_id = #{tempId}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelObjMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightExcelObjMapper"
>
<select
id=
"getByTempId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightExcelObj"
>
select *
from weight_data_excel_obj
where temp_id = #{tempId} and state = 1
order by order_num asc
</select>
<delete
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
delete
from weight_data_excel_obj
where temp_id = #{tempId}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelTemplateMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightExcelTemplateMapper"
>
<update
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
update weight_data_excel_temp
set state = 3
where id = #{id}
</update>
<select
id=
"getByWeightId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightExcelTemplate"
>
select *
from weight_data_excel_temp
where state = 1 and weight_id = #{weightId}
</select>
<update
id=
"deleteByWeightId"
parameterType=
"java.lang.Integer"
>
update weight_data_excel_temp
set state = 3
where state = 1 and weight_id = #{weightId}
</update>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightIndValueMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper"
>
<insert
id=
"batchInsert"
parameterType=
"list"
>
insert into weight_ind_value
(weight_id, ind_id,ind_name,ind_unit,ind_source, synthesize_weight, improve_weight, dimension_weight, obj_id,obj_name,obj_type,temp_id,
state,creator ,updater,create_time,update_time)
values
<foreach
collection=
"valueList"
item=
"val"
separator=
","
>
(#{val.weightId}, #{val.indId}, #{val.indName}, #{val.indUnit}, #{val.indSource},#{val.synthesizeWeight},#{val.improveWeight},
#{val.dimensionWeight},#{val.objId},#{val.objName},#{val.objType}, #{val.tempId},
#{val.state},#{val.creator},#{val.updater},#{val.createTime}, #{val.updateTime}
)
</foreach>
</insert>
<delete
id=
"batchDelete"
parameterType=
"com.keymobile.indicators.model.entity.weight.WeightIndValue"
>
<foreach
collection=
"newValues"
item=
"val"
separator=
";"
>
delete from weight_ind_value
where weight_id=#{val.weightId} and ind_id = #{val.indId} and obj_id = #{val.objId}
</foreach>
</delete>
<delete
id=
"deleteByWeightId"
parameterType=
"java.lang.Integer"
>
delete from weight_ind_value where weight_id = #{weightId}
</delete>
<select
id=
"findByWeightId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightIndValue"
>
select * from weight_ind_value where weight_id = #{weightId}
</select>
</mapper>
\ No newline at end of file
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