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
3a0ba982
Commit
3a0ba982
authored
Jul 13, 2020
by
张祺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改审批通过的指标值处理,并增加申请列表查看数据项的功能
parent
ebec0a80
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
203 additions
and
46 deletions
+203
-46
DataEnterCtrl.java
...com/keymobile/indicators/api/hytobacco/DataEnterCtrl.java
+20
-1
TaskIndValueMapper.java
...ndicators/model/mapper/indicators/TaskIndValueMapper.java
+18
-0
IndicatorsDataMapper.java
...dicators/model/mapper/indmapper/IndicatorsDataMapper.java
+5
-0
TaskService.java
...m/keymobile/indicators/service/dataenter/TaskService.java
+21
-0
TaskServiceImpl.java
...le/indicators/service/dataenter/impl/TaskServiceImpl.java
+88
-42
BaseIndDataService.java
...bile/indicators/service/hytobacco/BaseIndDataService.java
+17
-2
IndicatorsDataMapper.xml
src/main/resources/mybatis/mapping/IndicatorsDataMapper.xml
+13
-0
TaskIndicatorValueMapper.xml
...in/resources/mybatis/mapping/TaskIndicatorValueMapper.xml
+21
-1
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/DataEnterCtrl.java
View file @
3a0ba982
...
@@ -24,6 +24,9 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
...
@@ -24,6 +24,9 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -48,7 +51,7 @@ public class DataEnterCtrl {
...
@@ -48,7 +51,7 @@ public class DataEnterCtrl {
@Autowired
@Autowired
private
SystemAuthService
systemAuthService
;
private
SystemAuthService
systemAuthService
;
@ApiOperation
(
"获取需要在线填报的数据项"
)
@ApiOperation
(
"获取需要在线填报的数据项
(填报任务点击)
"
)
@GetMapping
(
"findToEdit"
)
@GetMapping
(
"findToEdit"
)
public
List
<
TaskIndValue
>
findToEdit
(
@RequestParam
(
"taskId"
)
String
taskId
)
{
public
List
<
TaskIndValue
>
findToEdit
(
@RequestParam
(
"taskId"
)
String
taskId
)
{
List
<
TaskIndValue
>
list
=
new
ArrayList
<>();
List
<
TaskIndValue
>
list
=
new
ArrayList
<>();
...
@@ -92,6 +95,22 @@ public class DataEnterCtrl {
...
@@ -92,6 +95,22 @@ public class DataEnterCtrl {
return
list
;
return
list
;
}
}
@ApiOperation
(
"获取已填报的数据项(审核清单点任务)"
)
@GetMapping
(
"findEnterValues"
)
public
Page
<
TaskIndValue
>
findEnterValues
(
@ApiParam
(
"任务ID"
)
@RequestParam
(
"taskId"
)
String
taskId
,
@ApiParam
(
value
=
"页码,从1开始"
,
defaultValue
=
"1"
)
@RequestParam
(
"pageNo"
)
int
pageNo
,
@ApiParam
(
value
=
"每页条数"
,
defaultValue
=
"10"
)
@RequestParam
(
"pageSize"
)
int
pageSize
)
{
List
<
TaskIndValue
>
list
=
new
ArrayList
<>();
long
total
=
taskService
.
findCountByTaskId
(
taskId
,
false
);
PageRequest
request
=
PageRequest
.
of
(
pageNo
-
1
,
pageSize
);
if
(
total
>
0
)
{
list
=
taskService
.
findByPageAndTaskId
(
taskId
,
request
.
getOffset
(),
pageSize
,
false
);
}
Page
<
TaskIndValue
>
pageResult
=
new
PageImpl
<>(
list
,
request
,
total
);
return
pageResult
;
}
/**
/**
* 生成填写对象
* 生成填写对象
* @param task
* @param task
...
...
src/main/java/com/keymobile/indicators/model/mapper/indicators/TaskIndValueMapper.java
View file @
3a0ba982
...
@@ -24,6 +24,24 @@ public interface TaskIndValueMapper extends BaseMapper<TaskIndValue> {
...
@@ -24,6 +24,24 @@ public interface TaskIndValueMapper extends BaseMapper<TaskIndValue> {
List
<
TaskIndValue
>
getByTaskId
(
String
taskId
);
List
<
TaskIndValue
>
getByTaskId
(
String
taskId
);
/**
/**
* 根据任务id翻页查找任务的填报值
* @param taskId
* @param start
* @param pageSize
* @param includeFormula 是否包含公式计算的数据项
* @return
*/
List
<
TaskIndValue
>
findByPageAndTaskId
(
@Param
(
"taskId"
)
String
taskId
,
@Param
(
"start"
)
long
start
,
@Param
(
"pageSize"
)
int
pageSize
,
@Param
(
"includeFormula"
)
boolean
includeFormula
);
/**
*根据任务id任务的填报值总数
* @param taskId
* @param includeFormula 是否包含公式计算的数据项
* @return
*/
long
findCountByTaskId
(
@Param
(
"taskId"
)
String
taskId
,
@Param
(
"includeFormula"
)
boolean
includeFormula
);
/**
* 任务id删除已填报的数据项值
* 任务id删除已填报的数据项值
* @param taskId
* @param taskId
*/
*/
...
...
src/main/java/com/keymobile/indicators/model/mapper/indmapper/IndicatorsDataMapper.java
View file @
3a0ba982
...
@@ -11,7 +11,12 @@ import tk.mybatis.mapper.common.BaseMapper;
...
@@ -11,7 +11,12 @@ import tk.mybatis.mapper.common.BaseMapper;
@Mapper
@Mapper
public
interface
IndicatorsDataMapper
extends
BaseMapper
<
IndicatorsData
>{
public
interface
IndicatorsDataMapper
extends
BaseMapper
<
IndicatorsData
>{
public
List
<
IndicatorsData
>
getDataByDimension
(
Map
<
String
,
Object
>
param
);
public
List
<
IndicatorsData
>
getDataByDimension
(
Map
<
String
,
Object
>
param
);
public
List
<
IndicatorsData
>
getIndDataByParam
(
Map
<
String
,
Object
>
param
);
public
List
<
IndicatorsData
>
getIndDataByParam
(
Map
<
String
,
Object
>
param
);
void
batchCreateIndData
(
List
<
IndicatorsData
>
datas
);
}
}
src/main/java/com/keymobile/indicators/service/dataenter/TaskService.java
View file @
3a0ba982
...
@@ -3,6 +3,7 @@ package com.keymobile.indicators.service.dataenter;
...
@@ -3,6 +3,7 @@ package com.keymobile.indicators.service.dataenter;
import
com.keymobile.indicators.model.entity.dataenter.*
;
import
com.keymobile.indicators.model.entity.dataenter.*
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.result.Result
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
@@ -110,6 +111,26 @@ public interface TaskService {
...
@@ -110,6 +111,26 @@ public interface TaskService {
List
<
TaskIndValue
>
findDefaultValues
(
String
valueTime
,
List
<
String
>
indIds
);
List
<
TaskIndValue
>
findDefaultValues
(
String
valueTime
,
List
<
String
>
indIds
);
/**
/**
* 根据任务id翻页查找任务的填报值
* @param taskId
* @param start
* @param pageSize
* @param includeFormula 是否包含公式计算的数据项
* @return
*/
List
<
TaskIndValue
>
findByPageAndTaskId
(
@Param
(
"taskId"
)
String
taskId
,
@Param
(
"start"
)
long
start
,
@Param
(
"pageSize"
)
int
pageSize
,
@Param
(
"includeFormula"
)
boolean
includeFormula
);
/**
*根据任务id任务的填报值总数
* @param taskId
* @param includeFormula 是否包含公式计算的数据项
* @return
*/
long
findCountByTaskId
(
@Param
(
"taskId"
)
String
taskId
,
@Param
(
"includeFormula"
)
boolean
includeFormula
);
/**
* 分发任务
* 分发任务
* @param param
* @param param
* @param userId
* @param userId
...
...
src/main/java/com/keymobile/indicators/service/dataenter/impl/TaskServiceImpl.java
View file @
3a0ba982
...
@@ -10,12 +10,14 @@ import com.keymobile.indicators.model.entity.ConfigInfo;
...
@@ -10,12 +10,14 @@ import com.keymobile.indicators.model.entity.ConfigInfo;
import
com.keymobile.indicators.model.entity.RoleRefUserModel
;
import
com.keymobile.indicators.model.entity.RoleRefUserModel
;
import
com.keymobile.indicators.model.entity.dataenter.*
;
import
com.keymobile.indicators.model.entity.dataenter.*
;
import
com.keymobile.indicators.model.entity.indicators.BaseIndDef
;
import
com.keymobile.indicators.model.entity.indicators.BaseIndDef
;
import
com.keymobile.indicators.model.entity.indicators.IndicatorsData
;
import
com.keymobile.indicators.model.mapper.indicators.*
;
import
com.keymobile.indicators.model.mapper.indicators.*
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.ConfigInfoService
;
import
com.keymobile.indicators.service.ConfigInfoService
;
import
com.keymobile.indicators.service.SystemAuthService
;
import
com.keymobile.indicators.service.SystemAuthService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleService
;
import
com.keymobile.indicators.service.dataenter.TaskService
;
import
com.keymobile.indicators.service.dataenter.TaskService
;
import
com.keymobile.indicators.service.hytobacco.BaseIndDataService
;
import
com.keymobile.indicators.service.hytobacco.IndicatorsRelService
;
import
com.keymobile.indicators.service.hytobacco.IndicatorsRelService
;
import
com.keymobile.indicators.utils.DateUtils
;
import
com.keymobile.indicators.utils.DateUtils
;
import
com.keymobile.indicators.utils.IdWorker
;
import
com.keymobile.indicators.utils.IdWorker
;
...
@@ -68,6 +70,9 @@ public class TaskServiceImpl implements TaskService {
...
@@ -68,6 +70,9 @@ public class TaskServiceImpl implements TaskService {
@Autowired
@Autowired
private
TaskRuleObjMapper
taskRuleObjMapper
;
private
TaskRuleObjMapper
taskRuleObjMapper
;
@Autowired
private
BaseIndDataService
baseIndDataService
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Task
createTask
(
Task
task
)
{
public
Task
createTask
(
Task
task
)
{
...
@@ -184,6 +189,16 @@ public class TaskServiceImpl implements TaskService {
...
@@ -184,6 +189,16 @@ public class TaskServiceImpl implements TaskService {
}
}
@Override
@Override
public
List
<
TaskIndValue
>
findByPageAndTaskId
(
String
taskId
,
long
start
,
int
pageSize
,
boolean
includeFormula
)
{
return
taskIndValueMapper
.
findByPageAndTaskId
(
taskId
,
start
,
pageSize
,
includeFormula
);
}
@Override
public
long
findCountByTaskId
(
String
taskId
,
boolean
includeFormula
)
{
return
taskIndValueMapper
.
findCountByTaskId
(
taskId
,
includeFormula
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
assignTask
(
TaskAssginParam
param
,
String
userId
)
{
public
void
assignTask
(
TaskAssginParam
param
,
String
userId
)
{
Task
parentTask
=
getById
(
param
.
getTaskId
(),
true
,
false
);
Task
parentTask
=
getById
(
param
.
getTaskId
(),
true
,
false
);
...
@@ -282,6 +297,7 @@ public class TaskServiceImpl implements TaskService {
...
@@ -282,6 +297,7 @@ public class TaskServiceImpl implements TaskService {
auditRecord
.
setTaskId
(
taskId
);
auditRecord
.
setTaskId
(
taskId
);
auditRecord
.
setId
(
IdWorker
.
getStrId
());
auditRecord
.
setId
(
IdWorker
.
getStrId
());
auditRecord
.
setPTaskId
(
task
.
getPId
());
auditRecord
.
setPTaskId
(
task
.
getPId
());
auditRecord
.
setState
(
Constants
.
DATA_STATE_A
);
auditRecord
.
setCreator
(
userId
);
auditRecord
.
setCreator
(
userId
);
auditRecord
.
setUpdater
(
userId
);
auditRecord
.
setUpdater
(
userId
);
auditRecord
.
setUpdateTime
(
now
);
auditRecord
.
setUpdateTime
(
now
);
...
@@ -315,8 +331,9 @@ public class TaskServiceImpl implements TaskService {
...
@@ -315,8 +331,9 @@ public class TaskServiceImpl implements TaskService {
if
(
auditResult
.
isResult
())
{
if
(
auditResult
.
isResult
())
{
status
=
Constants
.
APPLY_STATE_PASSED
;
status
=
Constants
.
APPLY_STATE_PASSED
;
recordType
=
"审批通过"
;
recordType
=
"审批通过"
;
List
<
IndicatorsData
>
datas
=
createCountIndValues
(
task
);
this
.
baseIndDataService
.
batchInsertData
(
datas
);
taskIndValueMapper
.
updateTaskValueToPass
(
task
.
getId
());
taskIndValueMapper
.
updateTaskValueToPass
(
task
.
getId
());
createCountIndValues
(
task
);
}
}
task
.
setStatus
(
status
);
task
.
setStatus
(
status
);
taskMapper
.
updateByPrimaryKey
(
task
);
taskMapper
.
updateByPrimaryKey
(
task
);
...
@@ -339,61 +356,90 @@ public class TaskServiceImpl implements TaskService {
...
@@ -339,61 +356,90 @@ public class TaskServiceImpl implements TaskService {
* 通过填报值计算出包含公式的数据项值
* 通过填报值计算出包含公式的数据项值
* @param task
* @param task
*/
*/
private
void
createCountIndValues
(
Task
task
)
{
private
List
<
IndicatorsData
>
createCountIndValues
(
Task
task
)
{
List
<
TaskIndicator
>
inds
=
taskIndicatorMapper
.
getByTaskId
(
task
.
getId
());
List
<
TaskIndicator
>
inds
=
taskIndicatorMapper
.
getByTaskId
(
task
.
getId
());
List
<
TaskIndValue
>
values
=
taskIndValueMapper
.
getByTaskId
(
task
.
getId
());
List
<
TaskIndValue
>
values
=
taskIndValueMapper
.
getByTaskId
(
task
.
getId
());
String
valueTime
=
task
.
getValueTime
().
replaceAll
(
"-"
,
""
);
Integer
vt
=
Integer
.
parseInt
(
valueTime
);
List
<
IndicatorsData
>
datas
=
new
ArrayList
<>();
for
(
TaskIndValue
value
:
values
)
{
IndicatorsData
data
=
new
IndicatorsData
();
data
.
setBatchNo
(
task
.
getId
());
data
.
setDataType
(
"double"
);
data
.
setDim2
(
vt
);
data
.
setDim1
(
value
.
getObjId
());
data
.
setIndId
(
value
.
getIndId
());
data
.
setIndDesc
(
value
.
getIndName
());
data
.
setType
(
"1"
);
data
.
setUnit
(
value
.
getIndUnit
());
data
.
setDim1Desc
(
value
.
getObjName
());
datas
.
add
(
data
);
}
TaskRuleGroupObj
groupObj
=
taskRuleObjMapper
.
getById
(
task
.
getGroupId
());
TaskRuleGroupObj
groupObj
=
taskRuleObjMapper
.
getById
(
task
.
getGroupId
());
List
<
TaskIndicator
>
needSumInds
=
new
ArrayList
<>();
List
<
TaskIndicator
>
needSumInds
=
new
ArrayList
<>();
for
(
TaskIndicator
taskIndicator
:
inds
)
{
for
(
TaskIndicator
taskIndicator
:
inds
)
{
if
(
StringUtils
.
isNotBlank
(
taskIndicator
.
getIndFormula
()))
{
if
(
StringUtils
.
isNotBlank
(
taskIndicator
.
getIndFormula
()))
{
needSumInds
.
add
(
taskIndicator
);
needSumInds
.
add
(
taskIndicator
);
}
}
}
}
if
(
needSumInds
.
isEmpty
())
{
if
(!
needSumInds
.
isEmpty
())
{
return
;
if
(
groupObj
!=
null
&&
StringUtils
.
isNotBlank
(
groupObj
.
getDetail
()))
{
}
List
<
String
>
ids
=
Arrays
.
asList
(
StringUtils
.
split
(
groupObj
.
getDetail
(),
Constants
.
SEP_COMMA
));
if
(
groupObj
!=
null
&&
StringUtils
.
isNotBlank
(
groupObj
.
getDetail
()))
{
List
<
AuthModel
>
models
=
new
ArrayList
<>();
List
<
String
>
ids
=
Arrays
.
asList
(
StringUtils
.
split
(
groupObj
.
getDetail
(),
Constants
.
SEP_COMMA
));
switch
(
groupObj
.
getObjType
())
{
List
<
AuthModel
>
models
=
new
ArrayList
<>();
case
Constants
.
OBJ_TYPE_ORG
:
switch
(
groupObj
.
getObjType
())
{
List
<
JSONObject
>
list
=
systemAuthService
.
getOrgByNos
(
ids
);
case
Constants
.
OBJ_TYPE_ORG
:
for
(
JSONObject
jo
:
list
)
{
List
<
JSONObject
>
list
=
systemAuthService
.
getOrgByNos
(
ids
);
AuthModel
model
=
new
AuthModel
();
for
(
JSONObject
jo
:
list
)
{
model
.
setId
(
jo
.
getString
(
"no"
));
AuthModel
model
=
new
AuthModel
();
model
.
setName
(
jo
.
getString
(
"name"
));
model
.
setId
(
jo
.
getString
(
"no"
));
models
.
add
(
model
);
model
.
setName
(
jo
.
getString
(
"name"
));
}
models
.
add
(
model
);
break
;
}
}
break
;
Map
<
String
,
String
>
idMapValues
=
new
HashMap
<>();
}
for
(
TaskIndValue
value
:
values
)
{
Map
<
String
,
String
>
idMapValues
=
new
HashMap
<>();
for
(
AuthModel
model
:
models
)
{
for
(
TaskIndValue
value
:
values
)
{
if
(
model
.
getId
().
equals
(
value
.
getObjId
()))
{
for
(
AuthModel
model
:
models
)
{
idMapValues
.
put
(
value
.
getIndId
(),
value
.
getIndValue
());
if
(
model
.
getId
().
equals
(
value
.
getObjId
()))
{
}
idMapValues
.
put
(
value
.
getIndId
(),
value
.
getIndValue
());
}
}
}
}
}
List
<
TaskIndValue
>
newValues
=
new
ArrayList
<>();
List
<
TaskIndValue
>
newValues
=
new
ArrayList
<>();
for
(
TaskIndicator
indicator
:
needSumInds
)
{
for
(
TaskIndicator
indicator
:
needSumInds
)
{
for
(
AuthModel
model
:
models
)
{
for
(
AuthModel
model
:
models
)
{
TaskIndValue
value
=
new
TaskIndValue
();
TaskIndValue
value
=
new
TaskIndValue
();
value
.
setIndId
(
indicator
.
getIndId
());
value
.
setIndId
(
indicator
.
getIndId
());
value
.
setIndName
(
indicator
.
getIndName
());
value
.
setIndName
(
indicator
.
getIndName
());
value
.
setValueTime
(
task
.
getValueTime
());
value
.
setValueTime
(
task
.
getValueTime
());
value
.
setIndUnit
(
indicator
.
getIndUnit
());
value
.
setIndUnit
(
indicator
.
getIndUnit
());
value
.
setObjId
(
model
.
getId
());
value
.
setObjId
(
model
.
getId
());
value
.
setState
(
Constants
.
DATA_STATE_A
);
value
.
setObjName
(
model
.
getName
());
value
.
setObjName
(
model
.
getName
());
value
.
setObjType
(
groupObj
.
getObjType
());
value
.
setObjType
(
groupObj
.
getObjType
());
value
.
setTaskId
(
task
.
getId
());
value
.
setTaskId
(
task
.
getId
());
newValues
.
add
(
value
);
newValues
.
add
(
value
);
IndicatorsData
data
=
new
IndicatorsData
();
data
.
setBatchNo
(
task
.
getId
());
data
.
setDataType
(
"double"
);
data
.
setDim2
(
vt
);
data
.
setDim1
(
value
.
getObjId
());
data
.
setDim1Desc
(
value
.
getObjName
());
data
.
setIndId
(
value
.
getIndId
());
data
.
setIndDesc
(
value
.
getIndName
());
data
.
setType
(
"1"
);
data
.
setUnit
(
value
.
getIndUnit
());
datas
.
add
(
data
);
}
}
}
taskIndValueMapper
.
batchInsert
(
newValues
);
}
else
{
LogManager
.
logError
(
Constants
.
LOG_CONTEXT_API
,
"上报数据出错,任务单位不存在或者内容为空"
+
task
.
getGroupId
());
}
}
taskIndValueMapper
.
batchInsert
(
values
);
}
else
{
LogManager
.
logError
(
Constants
.
LOG_CONTEXT_API
,
"上报数据出错,任务单位不存在或者内容为空"
+
task
.
getGroupId
());
}
}
return
datas
;
}
}
@Override
@Override
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/BaseIndDataService.java
View file @
3a0ba982
...
@@ -5,18 +5,20 @@ import java.util.HashMap;
...
@@ -5,18 +5,20 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.keymobile.indicators.model.entity.indicators.IndicatorsData
;
import
com.keymobile.indicators.model.entity.indicators.IndicatorsData
;
import
com.keymobile.indicators.model.mapper.indmapper.IndicatorsDataMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.IndicatorsDataMapper
;
@Service
@Service
@Slf4j
public
class
BaseIndDataService
{
public
class
BaseIndDataService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
BaseIndDataService
.
class
);
@Autowired
@Autowired
private
IndicatorsDataMapper
indicatorsDataMapper
;
private
IndicatorsDataMapper
indicatorsDataMapper
;
...
@@ -34,4 +36,17 @@ public class BaseIndDataService {
...
@@ -34,4 +36,17 @@ public class BaseIndDataService {
}
}
return
result
;
return
result
;
}
}
/**
* 一步批量插入数据
* @param datas
*/
@Async
public
void
batchInsertData
(
List
<
IndicatorsData
>
datas
)
{
log
.
info
(
"开始批量插入指标值数据项"
);
long
time
=
System
.
currentTimeMillis
();
indicatorsDataMapper
.
batchCreateIndData
(
datas
);
time
=
(
System
.
currentTimeMillis
()
-
time
)/
1000
;
log
.
info
(
"结束批量插入指标值数据项, 共耗费时间:{}秒"
,
time
);
}
}
}
src/main/resources/mybatis/mapping/IndicatorsDataMapper.xml
View file @
3a0ba982
...
@@ -21,4 +21,16 @@
...
@@ -21,4 +21,16 @@
#{obj}
#{obj}
</foreach>
</foreach>
</select>
</select>
<insert
id=
"batchCreateIndData"
parameterType=
"list"
>
insert into indi_data_def(
ind_id, ind_desc, type, batch_no, data_type, unit, dim1, dim2, value, dim1_desc)
values
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
(
#{#{val.indId}, #{val.indDesc}, #{val.type}, #{val.batchNo}, #{val.dataType},#{val.unit},
#{val.dim1},#{val.dim2},#{val.value},#{val.dim1Desc}
)
</foreach>
</insert>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/TaskIndicatorValueMapper.xml
View file @
3a0ba982
...
@@ -19,7 +19,26 @@
...
@@ -19,7 +19,26 @@
<select
id=
"getByTaskId"
parameterType=
"java.lang.String"
resultType=
"com.keymobile.indicators.model.entity.dataenter.TaskIndValue"
>
<select
id=
"getByTaskId"
parameterType=
"java.lang.String"
resultType=
"com.keymobile.indicators.model.entity.dataenter.TaskIndValue"
>
select *
select *
from data_enter_task_ind_val
from data_enter_task_ind_val
where task_id = #{taskId}
where task_id = #{taskId} and state = 1
order by ind_id asc
</select>
<select
id=
"findByPageAndTaskId"
resultType=
"com.keymobile.indicators.model.entity.dataenter.TaskIndValue"
>
select val.*
from data_enter_task_ind_val val left join data_enter_task_ind ind on
val.ind_id = ind.ind_id and val.task_id = ind.task_id and val.state = 1 and ind.state = 1
where val.task_id = #{taskId}
<if
test=
"!includeFormula"
>
and (ind.ind_formula is null or ind.ind_formula = '')
</if>
order by val.ind_id asc
limit #{start}, #{pageSize}
</select>
<select
id=
"findCountByTaskId"
resultType=
"long"
>
select count(id)
from data_enter_task_ind_val
where task_id = #{taskId} and state = 1
</select>
</select>
...
@@ -45,6 +64,7 @@
...
@@ -45,6 +64,7 @@
<if
test=
"indSource != null"
>
<if
test=
"indSource != null"
>
and ind_source = #{indSource}
and ind_source = #{indSource}
</if>
</if>
order by ind_id asc
</select>
</select>
<select
id=
"findDefaultValues"
parameterType=
"object"
resultType=
"com.keymobile.indicators.model.entity.dataenter.TaskIndValue"
>
<select
id=
"findDefaultValues"
parameterType=
"object"
resultType=
"com.keymobile.indicators.model.entity.dataenter.TaskIndValue"
>
...
...
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