This commit is contained in:
cuibaocheng 2021-01-26 18:16:05 +08:00
parent 3f61ea795b
commit 3240ecc3dc
36 changed files with 155 additions and 621 deletions

37
pom.xml
View File

@ -80,11 +80,48 @@
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<!--2021年1月26日16:56:32 CBC -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-ui</artifactId>
<version>2.0.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.2.RELEASE</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>

View File

@ -1,4 +1,4 @@
package cn.com.tenlion.businesscard;
package cn.com.tenlion;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,13 +1,12 @@
package com.cm.common.base;
package cn.com.tenlion.controller;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.RequestUtil;
import cn.com.tenlion.util.base.HashMapUtil;
import cn.com.tenlion.util.html.RequestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.net.URLDecoder;

View File

@ -1,134 +1,80 @@
package cn.com.tenlion.controller.app.apis.data;
package cn.com.tenlion.controller.app.apis.datadictionary;
import cn.com.tenlion.controller.AbstractController;
import cn.com.tenlion.pojo.dtos.datadictionary.DataDictionaryDTO;
import cn.com.tenlion.pojo.vos.datadictionary.DataDictionaryVO;
import cn.com.tenlion.service.datadictionary.IDataDictionaryService;
import cn.com.tenlion.util.cons.ISystemConstant;
import cn.com.tenlion.util.exception.SearchException;
import cn.com.tenlion.util.page.ListPage;
import cn.com.tenlion.util.result.ErrorResult;
import cn.com.tenlion.util.result.SuccessResult;
import cn.com.tenlion.util.result.SuccessResultList;
import cn.com.tenlion.util.ztree.ZTreeDTO;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("app/datadictionary")
public class DataDictionaryAppController {
public class DataDictionaryAppController extends AbstractController {
@Autowired
private IDataDictionaryService dataDictionaryService;
@PostMapping("savedictionary")
public SuccessResult saveDictionary(@RequestHeader("token") String token, @RequestBody DataDictionaryVO dictionaryVO) throws Exception {
public String saveDictionary(@RequestHeader("token") String token, @RequestBody DataDictionaryVO dictionaryVO) throws Exception {
return dataDictionaryService.saveDictionary(token, dictionaryVO);
}
@ApiOperation(value = "字典删除", notes = "通过id列表批量删除字典接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "ids", value = "字典ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removedictionary/{ids}")
public SuccessResult removeDictionary(@RequestHeader("token") String token, @PathVariable("ids") String ids) {
return dataDictionaryService.removeDictionary(token, ids);
public SuccessResult removeDictionary(@PathVariable("ids") String ids) throws Exception {
return dataDictionaryService.removeDictionary(ids);
}
@ApiOperation(value = "字典修改", notes = "字典修改接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "dictionaryId", value = "字典ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatedictionary/{dictionaryId}")
@CheckRequestBodyAnnotation
public SuccessResult updateDictionary(@RequestHeader("token") String token, @PathVariable("dictionaryId") String dictionaryId, @RequestBody DataDictionaryVO dictionaryVO) throws Exception {
return dataDictionaryService.updateDictionary(token, dictionaryId, dictionaryVO);
public SuccessResult updateDictionary(@PathVariable("dictionaryId") String dictionaryId, @RequestBody DataDictionaryVO dictionaryVO) throws Exception {
return dataDictionaryService.updateDictionary("", dictionaryId, dictionaryVO);
}
@ApiOperation(value = "字典详情ID查询", notes = "字典详情ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "dictionaryId", value = "字典ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getdictionarybyid/{dictionaryId}")
public DataDictionaryDTO getDictionaryById(@RequestHeader("token") String token, @PathVariable("dictionaryId") String dictionaryId) {
public DataDictionaryDTO getDictionaryById(@PathVariable("dictionaryId") String dictionaryId) throws Exception {
return getDictionaryByIdRelease(dictionaryId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典详情ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典详情ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictionaryId", value = "字典ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getdictionarybyid" + ISystemConstant.RELEASE_SUFFIX + "/{dictionaryId}")
public DataDictionaryDTO getDictionaryByIdRelease(@PathVariable("dictionaryId") String dictionaryId) {
public DataDictionaryDTO getDictionaryByIdRelease(@PathVariable("dictionaryId") String dictionaryId) throws Exception{
return dataDictionaryService.getDictionaryById(dictionaryId);
}
@ApiOperation(value = "字典列表上级ID查询", notes = "字典列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "dictionaryParentId", value = "字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionarybyparentid/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionaryByParentId(@RequestHeader("token") String token, @PathVariable("dictionaryParentId") String dictionaryParentId) {
return listDictionaryByParentIdRelease(dictionaryParentId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典列表上级ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictionaryParentId", value = "字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionarybyparentid" + ISystemConstant.RELEASE_SUFFIX + "/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionaryByParentIdRelease(@PathVariable("dictionaryParentId") String dictionaryParentId) {
return dataDictionaryService.listDictionaryByParentId(dictionaryParentId);
}
@ApiOperation(value = "字典全部列表上级ID查询", notes = "字典全部列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "dictionaryParentId", value = "字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionaryallbyparentid/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionary(@RequestHeader("token") String token, @PathVariable("dictionaryParentId") String dictionaryParentId) throws SearchException {
return listDictionaryRelease(dictionaryParentId);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典全部列表上级ID查询", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "字典全部列表上级ID查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictionaryParentId", value = "字典上级ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listdictionaryallbyparentid" + ISystemConstant.RELEASE_SUFFIX + "/{dictionaryParentId}")
public List<DataDictionaryDTO> listDictionaryRelease(@PathVariable("dictionaryParentId") String dictionaryParentId) throws SearchException {
return dataDictionaryService.listDictionaryAllByParentId(dictionaryParentId);
}
@ApiOperation(value = "分页字典列表", notes = "分页字典列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagedictionary")
public SuccessResultList<List<DataDictionaryDTO>> listPageDictionary(@RequestHeader("token") String token, ListPage page) {
return listPageDictionaryRelease(page);
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "分页字典列表", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "分页字典列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagedictionary" + ISystemConstant.RELEASE_SUFFIX)
public SuccessResultList<List<DataDictionaryDTO>> listPageDictionaryRelease(ListPage page) {
Map<String, Object> params = requestParams();
@ -141,22 +87,11 @@ public class DataDictionaryAppController {
return dataDictionaryService.listPageDictionary(page);
}
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listztreedictionary")
public List<ZTreeDTO> listZTreeDictionary(@RequestHeader("token") String token) throws SearchException {
return listZTreeDictionaryRelease();
}
@ApiOperation(value = ISystemConstant.API_TAGS_RELEASE_PREFIX + "zTree列表", notes = ISystemConstant.API_TAGS_RELEASE_PREFIX + "zTree列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listztreedictionary" + ISystemConstant.RELEASE_SUFFIX)
public List<ZTreeDTO> listZTreeDictionaryRelease() throws SearchException {
Map<String, Object> params = requestParams();

View File

@ -1,13 +1,9 @@
package com.cm.common.plugin.dao.datadictionary;
package cn.com.tenlion.dao.datadictionary;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.pojo.dtos.ZTreeDTO;
import cn.com.tenlion.pojo.dtos.datadictionary.DataDictionaryDTO;
import cn.com.tenlion.util.exception.SearchException;
import cn.com.tenlion.util.ztree.ZTreeDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@ -21,73 +17,20 @@ import java.util.Map;
@Repository
public interface IDataDictionaryDao {
/**
* 新增字典
*
* @param params
* @throws SaveException
*/
void saveDictionary(Map<String, Object> params) throws SaveException;
void saveDictionary(Map<String, Object> params) throws Exception;
/**
* 删除字典
*
* @param params
* @throws RemoveException
*/
void removeDictionary(Map<String, Object> params) throws RemoveException;
void removeDictionary(Map<String, Object> params) throws Exception;
/**
* 修改字典
*
* @param params
* @throws UpdateException
*/
void updateDictionary(Map<String, Object> params) throws UpdateException;
void updateDictionary(Map<String, Object> params) throws Exception;
/**
* 字典列表
*
* @param params
* @return
* @throws SearchException
*/
List<DataDictionaryDTO> listDictionary(Map<String, Object> params) throws SearchException;
/**
* 字典详情
*
* @param params
* @return
* @throws SearchException
*/
DataDictionaryDTO getDictionary(Map<String, Object> params) throws SearchException;
DataDictionaryDTO getDictionary(Map<String, Object> params) throws Exception;
/**
* 获取最后一个字字典
*
* @param parentId
* @return
* @throws SearchException
*/
DataDictionaryDTO getLastByParentId(String parentId) throws SearchException;
/**
* 字典ZTree列表
*
* @param params
* @return
* @throws SearchException
*/
List<ZTreeDTO> listZTreeDictionary(Map<String, Object> params) throws SearchException;
/**
* 子列表个数
*
* @param id
* @return
* @throws SearchException
*/
Integer countByParentId(String id) throws SearchException;
}

View File

@ -1,22 +1,11 @@
package com.cm.common.plugin.pojo.dtos.datadictionary;
package cn.com.tenlion.pojo.dtos.datadictionary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: DictionaryDTO
* @Description: 字典
* @Author: WangGeng
* @Date: 2019/11/18 14:17
* @Version: 1.0
**/
@ApiModel
public class DataDictionaryDTO implements Serializable {

View File

@ -1,17 +1,10 @@
package com.cm.common.plugin.pojo.vos.datadictionary;
package cn.com.tenlion.pojo.vos.datadictionary;
import com.cm.common.annotation.CheckEmptyAnnotation;
import com.cm.common.annotation.CheckNumberAnnotation;
import cn.com.tenlion.util.check.CheckEmptyAnnotation;
import cn.com.tenlion.util.check.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: DictionaryVO
* @Description: 字典视图
* @Author: WangGeng
* @Date: 2019/3/4 2:30 PM
* @Version: 1.0
**/
@ApiModel
public class DataDictionaryVO {

View File

@ -1,22 +1,12 @@
package com.cm.common.base;
package cn.com.tenlion.service;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.component.SecurityComponent;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.enums.RoleDataAuthorityEnum;
import com.cm.common.exception.AccessTokenException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.bos.UserInfoBO;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.token.app.AppTokenManager;
import com.cm.common.token.app.entity.AppTokenUser;
import com.cm.common.utils.DateUtil;
import cn.com.tenlion.util.base.DateUtil;
import cn.com.tenlion.util.ztree.ZTreeDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpSession;
import java.util.*;
@ -32,35 +22,8 @@ public abstract class AbstractService {
protected static Logger LOG = LoggerFactory.getLogger(AbstractService.class);
@Autowired
protected SecurityComponent securityComponent;
@Autowired
private HttpSession httpSession;
/**
* 设置新增基础数据
*
* @param params
*/
protected void setSaveInfo(Map<String, Object> params) {
UserInfoBO userInfoBO = securityComponent.getCurrentUser();
if (userInfoBO != null) {
setSave(userInfoBO.getUserId(), params);
} else {
setSave("1", params);
}
}
/**
* token类型设置新增基础数据
*
* @param token
* @param params
*/
protected void setSaveInfo(String token, Map<String, Object> params) {
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
setSave(appTokenUser.getId(), params);
}
/**
* 设置新增基础信息
*
@ -86,30 +49,6 @@ public abstract class AbstractService {
params.put("isDelete", 0);
}
/**
* 设置修改基础数据
*
* @param params
*/
protected void setUpdateInfo(Map<String, Object> params) {
UserInfoBO userInfoBO = securityComponent.getCurrentUser();
if (userInfoBO != null) {
setUpdate(userInfoBO.getUserId(), params);
} else {
setUpdateInfo("1", params);
}
}
/**
* token类型设置修改基础数据
*
* @param token
* @param params
*/
protected void setUpdateInfo(String token, Map<String, Object> params) {
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
setUpdate(appTokenUser.getId(), params);
}
/**
* 设置更新基础信息
@ -184,68 +123,6 @@ public abstract class AbstractService {
return new HashMap<>(initSize);
}
/**
* 是否管理员
*
* @return
*/
protected boolean isAdmin() {
if (ISystemConstant.ADMIN.equalsIgnoreCase(securityComponent.getCurrentUsername())) {
return true;
}
return false;
}
/**
* 获取基础部门ID列表
*
* @return
*/
protected List<String> listBaseDepartmentIds() {
if (isAdmin()) {
return null;
}
return securityComponent.getCurrentUser().getBaseDepartmentIds();
}
/**
* 查询资源结果
*
* @param result 结果
* @param errorMessage 异常提示
* @throws AccessTokenException
* @throws SearchException
*/
protected void searchResourceResult(String result, String errorMessage) throws AccessTokenException, SearchException {
if (result == null) {
throw new AccessTokenException("认证失败");
}
if (result.isEmpty()) {
throw new SearchException(errorMessage);
}
}
/**
* 更新结果
*
* @param result
* @param errorMessage
* @throws AccessTokenException
* @throws SearchException
*/
protected void updateResourceResult(String result, String errorMessage) throws AccessTokenException, SearchException {
if (result == null) {
throw new AccessTokenException("认证失败");
}
if (result.isEmpty()) {
throw new SearchException(errorMessage);
}
JSONObject resultObj = JSONObject.parseObject(result);
if (resultObj.getString("msg") != null) {
throw new SearchException(resultObj.getString("msg"));
}
}
/**
* 简单Excel的Header
*
@ -262,34 +139,4 @@ public abstract class AbstractService {
return listHeaders;
}
/**
* 设置数据权限信息
*
* @param params
*/
protected void setDataAuthorityInfo(Map<String, Object> params) {
UserInfoBO currentUser = securityComponent.getCurrentUser();
if (ISystemConstant.ADMIN.equals(securityComponent.getCurrentUser().getUserName())) {
return;
}
String dataAuthority = currentUser.getDataAuthority();
List<String> dataAuthorityUserIds = currentUser.getDataAuthorityUserIds();
if (org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.ALL.getDataAuthorityType(), dataAuthority)) {
return;
} else if (org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.SELF.getDataAuthorityType(), dataAuthority)) {
params.put(ISystemConstant.DATA_AUTHORITY, dataAuthority);
params.put(ISystemConstant.DATA_CREATOR, currentUser.getUserId());
} else if (org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.DEPARTMENT.getDataAuthorityType(), dataAuthority)
|| org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.CUSTOM.getDataAuthorityType(), dataAuthority)) {
if (Objects.isNull(dataAuthorityUserIds) || dataAuthorityUserIds.isEmpty()) {
LOG.debug("权限列表为空,设置查看个人");
params.put(ISystemConstant.DATA_AUTHORITY, RoleDataAuthorityEnum.SELF.getDataAuthorityType());
params.put(ISystemConstant.DATA_CREATOR, currentUser.getUserId());
} else {
params.put(ISystemConstant.DATA_AUTHORITY, dataAuthority);
params.put(ISystemConstant.DATA_CREATORS, dataAuthorityUserIds);
}
}
}
}

View File

@ -1,159 +1,34 @@
package com.cm.common.plugin.service.datadictionary;
package cn.com.tenlion.service.datadictionary;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.plugin.pojo.vos.datadictionary.DataDictionaryVO;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import cn.com.tenlion.pojo.dtos.datadictionary.DataDictionaryDTO;
import cn.com.tenlion.pojo.vos.datadictionary.DataDictionaryVO;
import cn.com.tenlion.util.exception.SearchException;
import cn.com.tenlion.util.page.ListPage;
import cn.com.tenlion.util.result.SuccessResult;
import cn.com.tenlion.util.result.SuccessResultList;
import cn.com.tenlion.util.ztree.ZTreeDTO;
import java.util.List;
import java.util.Map;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: IDictionaryService
* @Description: 字典
* @Author: WangGeng
* @Date: 2019/11/18 14:09
* @Version: 1.0
**/
public interface IDataDictionaryService {
/**
* 字典新增
*
* @param dictionaryVO
* @return
* @throws Exception
*/
SuccessResult saveDictionary(DataDictionaryVO dictionaryVO) throws Exception;
/**
* 字典新增
*
* @param token
* @param dictionaryVO
* @return
* @throws Exception
*/
SuccessResult saveDictionary(String token, DataDictionaryVO dictionaryVO) throws Exception;
String saveDictionary(String userId, DataDictionaryVO dictionaryVO) throws Exception;
/**
* 字典新增
*
* @param dictionaryVO
* @return 新增ID
* @throws Exception
*/
String saveDictionaryReturnId(DataDictionaryVO dictionaryVO) throws Exception;
SuccessResult removeDictionary(String ids) throws Exception;
/**
* 字典新增
*
* @param token
* @param dictionaryVO
* @return 新增ID
* @throws Exception
*/
String saveDictionaryReturnId(String token, DataDictionaryVO dictionaryVO) throws Exception;
SuccessResult updateDictionary(String userId, String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception;
/**
* 字典删除
*
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removeDictionary(String ids) throws RemoveException;
DataDictionaryDTO getDictionaryById(String dictionaryId) throws Exception;
/**
* 字典删除
*
* @param token
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removeDictionary(String token, String ids) throws RemoveException;
/**
* 字典修改
*
* @param dictionaryId
* @param dictionaryVO
* @return
* @throws Exception
*/
SuccessResult updateDictionary(String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception;
/**
* 字典修改
*
* @param token
* @param dictionaryId
* @param dictionaryVO
* @return
* @throws Exception
*/
SuccessResult updateDictionary(String token, String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception;
/**
* 通过ID获取字典
*
* @param dictionaryId
* @return
* @throws SearchException
*/
DataDictionaryDTO getDictionaryById(String dictionaryId) throws SearchException;
/**
* 通过上级ID获取字典列表
*
* @param dictionaryParentId
* @return
* @throws SearchException
*/
List<DataDictionaryDTO> listDictionaryByParentId(String dictionaryParentId) throws SearchException;
/**
* 通过上级ID获取字典全部列表
*
* @param dictionaryParentId
* @return
* @throws SearchException
*/
List<DataDictionaryDTO> listDictionaryAllByParentId(String dictionaryParentId) throws SearchException;
/**
* 分页获取字典列表
*
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<DataDictionaryDTO>> listPageDictionary(ListPage page) throws SearchException;
/**
* zTree列表
*
* @param params
* @return
* @throws SearchException
*/
List<ZTreeDTO> listZTreeDictionary(Map<String, Object> params) throws SearchException;
/**
* 字典列表通过字典编码
*
* @param dictionaryCode
* @return
* @throws SearchException
*/
List<DataDictionaryDTO> listDictionaryByDictionaryCode(String dictionaryCode) throws SearchException;
}

View File

@ -1,39 +1,27 @@
package com.cm.common.plugin.service.datadictionary.impl;
package cn.com.tenlion.service.datadictionary.impl;
import com.cm.common.base.AbstractService;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.dao.datadictionary.IDataDictionaryDao;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.plugin.pojo.vos.datadictionary.DataDictionaryVO;
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import cn.com.tenlion.dao.datadictionary.IDataDictionaryDao;
import cn.com.tenlion.pojo.dtos.datadictionary.DataDictionaryDTO;
import cn.com.tenlion.pojo.vos.datadictionary.DataDictionaryVO;
import cn.com.tenlion.service.AbstractService;
import cn.com.tenlion.service.datadictionary.IDataDictionaryService;
import cn.com.tenlion.util.base.DateUtil;
import cn.com.tenlion.util.base.HashMapUtil;
import cn.com.tenlion.util.base.UUIDUtil;
import cn.com.tenlion.util.cons.ISystemConstant;
import cn.com.tenlion.util.exception.SearchException;
import cn.com.tenlion.util.page.ListPage;
import cn.com.tenlion.util.result.SuccessResult;
import cn.com.tenlion.util.result.SuccessResultList;
import cn.com.tenlion.util.ztree.ZTreeDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: DictionaryServiceImpl
* @Description: 字典
* @Author: WangGeng
* @Date: 2019/11/18 14:09
* @Version: 1.0
**/
@Service
public class DataDictionaryServiceImpl extends AbstractService implements IDataDictionaryService {
@ -41,28 +29,7 @@ public class DataDictionaryServiceImpl extends AbstractService implements IDataD
private IDataDictionaryDao dictionaryDao;
@Override
public SuccessResult saveDictionary(DataDictionaryVO dictionaryVO) throws Exception {
saveDictionaryInfo(null, dictionaryVO);
return new SuccessResult();
}
@Override
public SuccessResult saveDictionary(String token, DataDictionaryVO dictionaryVO) throws Exception {
saveDictionaryInfo(token, dictionaryVO);
return new SuccessResult();
}
@Override
public String saveDictionaryReturnId(DataDictionaryVO dictionaryVO) throws Exception {
return saveDictionaryInfo(null, dictionaryVO);
}
@Override
public String saveDictionaryReturnId(String token, DataDictionaryVO dictionaryVO) throws Exception {
return saveDictionaryInfo(token, dictionaryVO);
}
private String saveDictionaryInfo(String token, DataDictionaryVO dictionaryVO) throws Exception {
public String saveDictionary(String userId, DataDictionaryVO dictionaryVO) throws Exception {
String uuid = UUIDUtil.getUUID();
String parentCode = null;
String dictionaryParentId = dictionaryVO.getDictionaryParentId();
@ -74,78 +41,51 @@ public class DataDictionaryServiceImpl extends AbstractService implements IDataD
Map<String, Object> params = HashMapUtil.beanToMap(dictionaryVO);
params.put("dictionaryCode", dictionaryCode);
params.put("dictionaryId", uuid);
if (StringUtils.isBlank(token)) {
setSaveInfo(params);
} else {
setSaveInfo(token, params);
}
params.put("creator", userId);
params.put("gmtCreate", DateUtil.getTime());
params.put("modifier", "");
params.put("gmtModified", "");
params.put("isDelete", 0);
dictionaryDao.saveDictionary(params);
return uuid;
}
@Override
public SuccessResult removeDictionary(String ids) throws RemoveException {
removeDictionaryInfo(null, ids);
return new SuccessResult();
}
@Override
public SuccessResult removeDictionary(String token, String ids) throws RemoveException {
removeDictionaryInfo(token, ids);
return new SuccessResult();
}
private void removeDictionaryInfo(String token, String ids) {
Map<String, Object> params = getHashMap(3);
public SuccessResult removeDictionary(String ids) throws Exception {
Map<String, Object> params = new HashMap<>(3);
params.put("dictionaryIds", Arrays.asList(ids.split("_")));
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {
setUpdateInfo(token, params);
}
dictionaryDao.removeDictionary(params);
}
@Override
public SuccessResult updateDictionary(String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception {
updateDictionaryInfo(null, dictionaryId, dictionaryVO);
return new SuccessResult();
}
@Override
public SuccessResult updateDictionary(String token, String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception {
updateDictionaryInfo(token, dictionaryId, dictionaryVO);
return new SuccessResult();
}
private void updateDictionaryInfo(String token, String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception {
public SuccessResult updateDictionary(String userId, String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(dictionaryVO);
params.put("dictionaryId", dictionaryId);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {
setUpdateInfo(token, params);
}
params.put("modifier", userId);
params.put("gmtModified", DateUtil.getTime());
params.put("isDelete", 0);
dictionaryDao.updateDictionary(params);
return new SuccessResult();
}
@Override
public DataDictionaryDTO getDictionaryById(String dictionaryId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
public DataDictionaryDTO getDictionaryById(String dictionaryId) throws Exception {
Map<String, Object> params = new HashMap<>(3);
params.put("dictionaryId", dictionaryId);
return dictionaryDao.getDictionary(params);
}
@Override
public List<DataDictionaryDTO> listDictionaryByParentId(String dictionaryParentId) throws SearchException {
Map<String, Object> params = getHashMap(1);
Map<String, Object> params = new HashMap<>(3);
params.put("dictionaryParentId", dictionaryParentId);
return dictionaryDao.listDictionary(params);
}
@Override
public List<DataDictionaryDTO> listDictionaryAllByParentId(String dictionaryParentId) throws SearchException {
Map<String, Object> params = getHashMap(1);
Map<String, Object> params = new HashMap<>(3);
params.put("dictionaryParentId", dictionaryParentId);
List<DataDictionaryDTO> dictionaryDTOs = dictionaryDao.listDictionary(params);
listSubDictionarys(dictionaryDTOs, params);

View File

@ -1,6 +1,5 @@
package cn.com.tenlion.util;
import com.sun.org.apache.xml.internal.security.utils.Base64;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@ -14,19 +13,10 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.security.Security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

View File

@ -1,8 +1,7 @@
package com.cm.common.utils;
package cn.com.tenlion.util.base;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

View File

@ -1,4 +1,4 @@
package com.cm.common.utils;
package cn.com.tenlion.util.base;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

View File

@ -1,4 +1,4 @@
package com.cm.common.utils;
package cn.com.tenlion.util.base;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package com.cm.common.utils;
package cn.com.tenlion.util.base;
import net.sourceforge.pinyin4j.PinyinHelper;
@ -7,7 +7,6 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@ -1,4 +1,4 @@
package com.cm.common.annotation;
package cn.com.tenlion.util.check;
/**
* When you feel like quitting. Think about why you started

View File

@ -1,4 +1,4 @@
package com.cm.common.annotation;
package cn.com.tenlion.util.check;
import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package com.cm.common.annotation;
package cn.com.tenlion.util.check;
import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package com.cm.common.annotation;
package cn.com.tenlion.util.check;
import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package com.cm.common.annotation;
package cn.com.tenlion.util.check;
import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package com.cm.common.annotation;
package cn.com.tenlion.util.check;
import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package com.cm.common.constants;
package cn.com.tenlion.util.cons;
/**
* @ClassName: ISystemConstant

View File

@ -1,6 +1,4 @@
package com.cm.common.exception;
import com.cm.common.exception.base.SystemException;
package cn.com.tenlion.util.exception;
/**
* @ClassName: ParamsException

View File

@ -1,6 +1,4 @@
package com.cm.common.exception;
import com.cm.common.exception.base.SystemException;
package cn.com.tenlion.util.exception;
/**
* @ClassName: RemoveException

View File

@ -1,6 +1,4 @@
package com.cm.common.exception;
import com.cm.common.exception.base.SystemException;
package cn.com.tenlion.util.exception;
/**
* @ClassName: SaveException

View File

@ -1,6 +1,4 @@
package com.cm.common.exception;
import com.cm.common.exception.base.SystemException;
package cn.com.tenlion.util.exception;
/**
* @ClassName: SearchException

View File

@ -1,4 +1,4 @@
package com.cm.common.exception.base;
package cn.com.tenlion.util.exception;
/**
* @ClassName: SystemException

View File

@ -1,11 +1,10 @@
package com.cm.common.utils;
package cn.com.tenlion.util.html;
import com.cm.common.exception.base.SystemException;
import cn.com.tenlion.util.exception.SystemException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;

View File

@ -1,7 +1,4 @@
package com.cm.common.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
package cn.com.tenlion.util.page;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package com.cm.common.result;
package cn.com.tenlion.util.result;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package com.cm.common.result;
package cn.com.tenlion.util.result;
import io.swagger.annotations.ApiModel;

View File

@ -1,4 +1,4 @@
package com.cm.common.result;
package cn.com.tenlion.util.result;
import io.swagger.annotations.ApiModel;

View File

@ -1,4 +1,4 @@
package com.cm.common.result;
package cn.com.tenlion.util.result;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package com.cm.common.result;
package cn.com.tenlion.util.result;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package com.cm.common.pojo.dtos;
package cn.com.tenlion.util.ztree;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,10 +1,10 @@
<?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.cm.common.plugin.dao.datadictionary.IDataDictionaryDao">
<mapper namespace="cn.com.tenlion.dao.datadictionary.IDataDictionaryDao">
<cache/>
<resultMap id="dictionaryDTO" type="com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO">
<resultMap id="dictionaryDTO" type="cn.com.tenlion.pojo.dtos.datadictionary.DataDictionaryDTO">
<id property="dictionaryId" column="dictionary_id"/>
<result property="dictionaryParentId" column="dictionary_parent_id"/>
<result property="dictionaryParentName" column="dictionary_parent_name"/>
@ -14,7 +14,7 @@
<result property="dictionarySort" column="dictionary_sort"/>
</resultMap>
<resultMap id="dictionaryZTreeDTO" type="com.cm.common.pojo.dtos.ZTreeDTO">
<resultMap id="dictionaryZTreeDTO" type="cn.com.tenlion.util.ztree.ZTreeDTO">
<id property="id" column="dictionary_id"/>
<result property="pId" column="dictionary_parent_id"/>
<result property="name" column="dictionary_name"/>