Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
d9a6d3ac
Commit
d9a6d3ac
authored
May 31, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add apis for report delete
parent
b0315d01
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
12 deletions
+99
-12
TemplateController.java
.../java/pwc/taxtech/atms/controller/TemplateController.java
+8
-0
DeleteTemplateParam.java
...c/main/java/pwc/taxtech/atms/dto/DeleteTemplateParam.java
+31
-0
TemplateService.java
...c/main/java/pwc/taxtech/atms/service/TemplateService.java
+4
-4
TemplateGroupServiceImpl.java
...c/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
+5
-6
TemplateServiceImpl.java
...va/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
+51
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/TemplateController.java
View file @
d9a6d3ac
...
...
@@ -8,8 +8,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
pwc.taxtech.atms.common.ApplicationException
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.TemplateDto
;
import
pwc.taxtech.atms.dto.TemplateUniqDto
;
import
pwc.taxtech.atms.dto.UpateNameParam
;
import
pwc.taxtech.atms.service.TemplateService
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -105,4 +107,10 @@ public class TemplateController {
List
<
TemplateUniqDto
>
getTemplateUniqList
(
String
serviceTypeID
,
Integer
payTaxType
,
Integer
reportType
,
String
industryIDs
)
{
return
templateService
.
getTemplateUniqList
(
serviceTypeID
,
payTaxType
,
reportType
,
industryIDs
);
}
@RequestMapping
(
value
=
"updateTemplateName"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
@ResponseBody
OperationResultDto
<
Object
>
updateTemplateName
(
@RequestBody
UpateNameParam
param
){
return
templateService
.
updateTemplateName
(
param
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/DeleteTemplateParam.java
0 → 100644
View file @
d9a6d3ac
package
pwc
.
taxtech
.
atms
.
dto
;
public
class
DeleteTemplateParam
{
private
String
ID
;
private
boolean
isDeletePermanent
;
private
String
path
;
public
String
getID
()
{
return
ID
;
}
public
void
setID
(
String
ID
)
{
this
.
ID
=
ID
;
}
public
boolean
isDeletePermanent
()
{
return
isDeletePermanent
;
}
public
void
setDeletePermanent
(
boolean
deletePermanent
)
{
isDeletePermanent
=
deletePermanent
;
}
public
String
getPath
()
{
return
path
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/TemplateService.java
View file @
d9a6d3ac
package
pwc
.
taxtech
.
atms
.
service
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.TemplateDto
;
import
pwc.taxtech.atms.dto.TemplateUniqDto
;
import
pwc.taxtech.atms.dto.UpateNameParam
;
import
pwc.taxtech.atms.dto.*
;
import
java.util.List
;
...
...
@@ -20,4 +17,7 @@ public interface TemplateService {
List
<
TemplateUniqDto
>
getTemplateUniqList
(
String
serviceTypeID
,
Integer
payTaxType
,
Integer
reportType
,
String
industryIDs
);
OperationResultDto
<
Object
>
updateTemplateName
(
UpateNameParam
param
);
OperationResultDto
<
String
>
deleteTemplate
(
DeleteTemplateParam
param
);
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
View file @
d9a6d3ac
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.constant.enums.TemplateGroupType
;
...
...
@@ -69,7 +70,7 @@ public class TemplateGroupServiceImpl extends AbstractService implements Templat
}
@Override
@Transactional
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Exception
.
class
)
public
OperationResultDto
<
Object
>
deleteTemplateGroup
(
TemplateGroupDto
templateGroupDto
)
{
OperationResultDto
<
Object
>
result
=
new
OperationResultDto
<>();
TemplateGroup
templateGroupDb
=
templateGroupMapper
.
selectByPrimaryKey
(
templateGroupDto
.
getID
());
...
...
@@ -115,11 +116,9 @@ public class TemplateGroupServiceImpl extends AbstractService implements Templat
}
public
class
TemplateGroupMessage
{
public
static
final
String
TEMPLATE_GROUP_NAME_EXIST
=
"TemplateGroupNameExist"
;
public
static
final
String
SYSTEM_TYPE_CANNOT_DELETE
=
"SystemTypeCannotDelete"
;
public
static
final
String
ORGANIZATION_USED_TEMPLATE_GROUP
=
"OrganizationUsedTemplateGroup"
;
static
final
String
TEMPLATE_GROUP_NAME_EXIST
=
"TemplateGroupNameExist"
;
static
final
String
SYSTEM_TYPE_CANNOT_DELETE
=
"SystemTypeCannotDelete"
;
static
final
String
ORGANIZATION_USED_TEMPLATE_GROUP
=
"OrganizationUsedTemplateGroup"
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
View file @
d9a6d3ac
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.dto.*
;
import
pwc.taxtech.atms.entitiy.CellTemplateExample
;
import
pwc.taxtech.atms.entitiy.Template
;
import
pwc.taxtech.atms.entitiy.TemplateExample
;
import
pwc.taxtech.atms.service.TemplateService
;
...
...
@@ -15,6 +18,7 @@ import static java.util.stream.Collectors.groupingBy;
@Service
public
class
TemplateServiceImpl
extends
AbstractService
implements
TemplateService
{
private
final
String
PREFIX_VALUE
=
"~"
;
@Override
public
List
<
TemplateDto
>
get
(
String
templateGroupID
,
Integer
reportType
)
{
...
...
@@ -45,7 +49,7 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
Template
template
=
templateMapper
.
selectByPrimaryKey
(
templateID
);
if
(
template
!=
null
)
{
if
(
template
.
getPath
().
startsWith
(
"~"
))
{
if
(
template
.
getPath
().
startsWith
(
PREFIX_VALUE
))
{
result
=
template
.
getPath
().
substring
(
1
,
template
.
getPath
().
length
());
}
else
{
result
=
template
.
getPath
();
...
...
@@ -124,7 +128,7 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
result
.
setResultMsg
(
"TemplateNotExist"
);
return
result
;
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
3
);
map
.
put
(
"templateGroupID"
,
templateDb
.
getTemplateGroupID
());
map
.
put
(
"templateID"
,
param
.
getID
());
map
.
put
(
"templateName"
,
param
.
getName
());
...
...
@@ -146,4 +150,49 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
result
.
setResult
(
true
);
return
result
;
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Exception
.
class
)
public
OperationResultDto
<
String
>
deleteTemplate
(
DeleteTemplateParam
param
)
{
OperationResultDto
<
String
>
result
=
new
OperationResultDto
<>();
Template
templateDb
=
templateMapper
.
selectByPrimaryKey
(
param
.
getID
());
String
path
=
""
;
if
(
templateDb
!=
null
)
{
TemplateExample
example
=
new
TemplateExample
();
example
.
createCriteria
().
andCodeEqualTo
(
templateDb
.
getCode
()).
andIDEqualTo
(
templateDb
.
getID
()).
andIsActiveAssociationEqualTo
(
false
);
long
count
=
templateMapper
.
countByExample
(
example
);
if
(
count
>
0
)
{
path
=
templateDb
.
getPath
();
//物理删除
deleteIsAtiveAssociation
(
templateDb
);
}
else
{
if
(
param
.
isDeletePermanent
()
&&
!
templateDb
.
getIsSystemType
())
{
path
=
templateDb
.
getPath
();
//物理删除
deleteIsAtiveAssociation
(
templateDb
);
}
else
{
//逻辑删除
logicDeleteIsActiveAssociation
(
templateDb
);
}
}
}
result
.
setResult
(
true
);
result
.
setData
(
path
);
return
result
;
}
private
void
logicDeleteIsActiveAssociation
(
Template
templateDb
)
{
templateDb
.
setIsActiveAssociation
(
false
);
templateMapper
.
updateByPrimaryKeySelective
(
templateDb
);
}
private
void
deleteIsAtiveAssociation
(
Template
templateDb
)
{
cellTemplateConfigMapper
.
deleteCellTemplateConfigByCellTemplate
(
templateDb
.
getID
());
keyValueReferenceMapper
.
deleteKeyValueReferenceByCellTemplate
(
templateDb
.
getID
());
CellTemplateExample
example
=
new
CellTemplateExample
();
example
.
createCriteria
().
andReportTemplateIDEqualTo
(
templateDb
.
getID
());
cellTemplateMapper
.
deleteByExample
(
example
);
}
}
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