Commit 4927b120 by guojuxing

pmd

parent 0c95b6b6
......@@ -69,6 +69,12 @@
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>${gic-commons}</version>
</dependency>
</dependencies>
<build>
......
package com.gic.enterprise.constant;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:04 AM

*/
public enum FieldFilterOptEnum {
/**等于*/
EQ("=", "等于"),
......
package com.gic.enterprise.constant;
/**
* 自定义字段类型
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:58 AM

*/
public enum FieldTypeEnum {
/**
* int"),
*/
INT("int", "int"),
/**
* string"),
*/
STRING("string", "string"),
/**
* date"),
*/
DATE("date", "date"),
/**
* long");
*/
LONG("long", "long");
private String type;
private String message;
......
......@@ -7,7 +7,13 @@ import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* hive数据处理
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:37 AM

*/
public class HiveDataDownloadDTO implements Serializable {
public interface hiveData{
......@@ -140,4 +146,22 @@ public class HiveDataDownloadDTO implements Serializable {
public void setQueryConditionList(List<HiveQueryCondition> queryConditionList) {
this.queryConditionList = queryConditionList;
}
@Override
public String toString() {
return "HiveDataDownloadDTO{" +
"enterpriseId=" + enterpriseId +
", tableName='" + tableName + '\'' +
", queryConditionList=" + queryConditionList +
", applyUserId=" + applyUserId +
", dataContent='" + dataContent + '\'' +
", dataType=" + dataType +
", dataUrl='" + dataUrl + '\'' +
", fileName='" + fileName + '\'' +
", excelExtension=" + excelExtension +
", reportStartTime='" + reportStartTime + '\'' +
", reportEndTime='" + reportEndTime + '\'' +
", desenField=" + desenField +
'}';
}
}
......@@ -5,7 +5,13 @@ import com.gic.enterprise.constant.FieldTypeEnum;
import java.io.Serializable;
import java.util.List;
/**
* 查询条件
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:04 AM

*/
public class HiveQueryCondition implements Serializable {
/**字段名 enterprise_id*/
private String fieldName;
......
package com.gic.enterprise.dto;
import com.gic.commons.annotation.SkipNamingCheck;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
......@@ -10,6 +12,7 @@ import java.util.List;
* @author taogs
* @date 2020/9/17 16:26
*/
@SkipNamingCheck
public class QrcodeDTO implements Serializable {
private Integer h5 = 0;
private String appletIds;
......
......@@ -4,7 +4,11 @@ import java.io.Serializable;
import java.util.Date;
/**
* tab_table_setting
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:36 AM

*/
public class TableSettingDTO implements Serializable {
/**
......@@ -150,4 +154,21 @@ public class TableSettingDTO implements Serializable {
public void setCreatetorName(String createtorName) {
this.createtorName = createtorName;
}
@Override
public String toString() {
return "TableSettingDTO{" +
"tableId=" + tableId +
", tableName='" + tableName + '\'' +
", saveExtInterface='" + saveExtInterface + '\'' +
", delExtInterface='" + delExtInterface + '\'' +
", extInterface='" + extInterface + '\'' +
", remark='" + remark + '\'' +
", createTime=" + createTime +
", repeateSetting='" + repeateSetting + '\'' +
", repeateOpt=" + repeateOpt +
", createtor='" + createtor + '\'' +
", createtorName='" + createtorName + '\'' +
'}';
}
}
\ No newline at end of file
......@@ -4,7 +4,11 @@ import java.io.Serializable;
import java.util.Date;
/**
* tab_table_setting_field
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:37 AM

*/
public class TableSettingFieldDTO implements Serializable {
/**
......@@ -97,4 +101,17 @@ public class TableSettingFieldDTO implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "TableSettingFieldDTO{" +
"fieldId=" + fieldId +
", tableId=" + tableId +
", fieldKey='" + fieldKey + '\'' +
", fieldName='" + fieldName + '\'' +
", fieldType='" + fieldType + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ public interface BlackListApiService {
/**
* 新增黑名单
* @param enterpriseId
* @return
*/
ServiceResponse<Void> saveBlackList(Integer enterpriseId);
......
......@@ -4,7 +4,13 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import java.util.Map;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:03 AM

*/
public interface CustomSettingApiService {
/**
* save
......
......@@ -101,6 +101,11 @@ public interface DownloadReportApiService {
*/
ServiceResponse<String> saveDownloadLogReturnDownloadUrl(Integer downloadReportId, Integer loginUserId);
/**
* 接收心跳
* @param reportId
* @return
*/
ServiceResponse<Void> receiveHeart(Integer reportId);
}
......@@ -2,7 +2,18 @@ package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.HiveDataDownloadDTO;
/**
* hive数据处理
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:57 AM

*/
public interface HiveDataDownloadApiService {
/**
* 创建任务
* @param hiveDataDownloadDTO
* @return
*/
ServiceResponse<Integer> createDownloadTask(HiveDataDownloadDTO hiveDataDownloadDTO);
}
......@@ -16,7 +16,7 @@ import javax.validation.constraints.NotNull;
*/
public interface ProductMarketApiService {
/**
*
* 心中达摩情报站
* @param productMarketDTO
* @return
*/
......
......@@ -6,7 +6,13 @@ import com.gic.enterprise.dto.TableSettingDTO;
import com.gic.enterprise.dto.TableSettingFieldDTO;
import java.util.List;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:59 AM

*/
public interface TableSettingApiService {
/**
* saveTableSetting
......
......@@ -57,6 +57,7 @@ public interface TabBlackListMapper {
/**
* 查询列表
* @param search
* @return
*/
List<TabBlackList> listBlackList(@Param("search") String search);
......
......@@ -76,5 +76,9 @@ public interface TabDownloadReportMapper {
*/
Page<TabDownloadReport> listDownloadReport(DownloadReportQO downloadReportQO);
/**
* 未完成任务
* @return
*/
List<TabDownloadReport> listUnfinishedTask();
}
\ No newline at end of file
......@@ -64,6 +64,7 @@ public interface TabProductMarketMapper {
/**
* 是否有新消息(当天发布,并且时间小于当前时间,精确到秒)
* @param today
* @return
*/
Integer countNewInfo(@Param("today") String today);
......
......@@ -4,7 +4,13 @@ import com.gic.enterprise.entity.TabTableSettingField;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:03 AM

*/
public interface TabTableSettingFieldMapper {
/**
* 根据主键删除
......@@ -65,5 +71,11 @@ public interface TabTableSettingFieldMapper {
*/
List<TabTableSettingField> listField(@Param("tableId") Integer tableId);
/**
* 获取字段
* @param tableId
* @param fieldKey
* @return
*/
TabTableSettingField getFieldByKey(@Param("tableId") Integer tableId, @Param("fieldKey") String fieldKey);
}
\ No newline at end of file
......@@ -3,7 +3,13 @@ package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabTableSetting;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:02 AM

*/
public interface TabTableSettingMapper {
/**
* 根据主键删除
......@@ -62,7 +68,17 @@ public interface TabTableSettingMapper {
int updateByPrimaryKey(TabTableSetting record);
/**
* 操作
* @param search
* @return
*/
Page<TabTableSetting> pageTableSetting(@Param("search") String search);
/**
* 操作
* @param tableName
* @return
*/
TabTableSetting getTableSettingByTableName(@Param("tableName") String tableName);
}
\ No newline at end of file
......@@ -5,7 +5,13 @@ import com.gic.dsmongo.api.anno.MongDataBase;
import com.gic.dsmongo.api.dto.MongoBaseEntity;
import java.io.Serializable;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:03 AM

*/
@MongDataBase(name = "custom-table")
@Document(collection = "")
public class CustomSettingData extends MongoBaseEntity implements Serializable {
......
......@@ -3,7 +3,11 @@ package com.gic.enterprise.entity;
import java.util.Date;
/**
* tab_download_report
* 报表中心
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:57 AM

*/
public class TabDownloadReport {
/**
......
......@@ -3,7 +3,11 @@ package com.gic.enterprise.entity;
import java.util.Date;
/**
* tab_table_setting
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:02 AM

*/
public class TabTableSetting {
/**
......
......@@ -3,7 +3,11 @@ package com.gic.enterprise.entity;
import java.util.Date;
/**
* tab_table_setting_field
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:02 AM

*/
public class TabTableSettingField {
/**
......
......@@ -2,7 +2,13 @@ package com.gic.enterprise.pojo;
import java.util.ArrayList;
import java.util.List;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:03 AM

*/
public class DownloadTaskPOJO {
/***报告id***/
private Integer reportId;
......
......@@ -44,6 +44,7 @@ public interface DownloadReportService {
* @author taogs
* @param downloadReportId
* @param downloadUrl
* @param count
* @return java.lang.Integer
* @throws
*/
......@@ -114,5 +115,9 @@ public interface DownloadReportService {
*/
void updateDataCount(Integer reportId, Integer count);
/**
* 未完成任务
* @return
*/
List<TabDownloadReport> listUnfinishedTask();
}
......@@ -3,11 +3,31 @@ package com.gic.enterprise.service;
import com.gic.enterprise.dto.TableSettingFieldDTO;
import java.util.List;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:54 AM

*/
public interface TableSettingFieldService {
/**
* 心中
* @param tableSettingFieldDTO
* @return
*/
String saveTableField(TableSettingFieldDTO tableSettingFieldDTO);
/**
* 配置
* @param tableId
* @return
*/
List<TableSettingFieldDTO> listTableField(Integer tableId);
/**
* 配置
* @param fieldId
*/
void delTableField(Integer fieldId);
}
......@@ -2,16 +2,46 @@ package com.gic.enterprise.service;
import com.gic.enterprise.entity.TabTableSetting;
import com.github.pagehelper.Page;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:55 AM

*/
public interface TableSettingService {
/**
* 操作
* @param tabTableSetting
* @return
*/
String saveTableSetting(TabTableSetting tabTableSetting);
/**
* 操作
* @param search
* @return
*/
Page<TabTableSetting> pageTableSetting(String search);
/**
* 操作
* @param tableId
* @return
*/
TabTableSetting getTableSetting(Integer tableId);
/**
* 操作
* @param tableId
*/
void delTabSetting(Integer tableId);
/**
* 操作
* @param tableName
* @return
*/
TabTableSetting getTableSetting(String tableName);
}
......@@ -11,7 +11,13 @@ import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:02 AM

*/
@Service
public class TableSettingFieldServiceImpl implements TableSettingFieldService {
@Autowired
......@@ -25,7 +31,7 @@ public class TableSettingFieldServiceImpl implements TableSettingFieldService {
TabTableSettingField field = tabTableSettingFieldMapper.getFieldByKey(tab.getTableId(), tab.getFieldKey());
if(tab.getFieldId() != null){
if(field != null){
if(field.getFieldId() != tab.getFieldId()){
if(!field.getFieldId().equals(tab.getFieldId())){
return "该字段已经存在";
}
}
......@@ -52,7 +58,8 @@ public class TableSettingFieldServiceImpl implements TableSettingFieldService {
if(field == null){
return;
}
if(field.getFieldKey().equals("id")){
boolean isContainIdKey = "id".equals(field.getFieldKey());
if(isContainIdKey){
return;
}
field.setFieldId(fieldId);
......
......@@ -12,7 +12,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:02 AM

*/
@Service
public class TableSettingServiceImpl implements TableSettingService {
private static final Logger log = LogManager.getLogger(TableSettingServiceImpl.class);
......
......@@ -17,7 +17,13 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/**
* 联合商户资源详情
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:58 AM

*/
@Service("unionEnterpriseAuthResDetailService")
public class UnionEnterpriseAuthResDetailServiceImpl implements UnionEnterpriseAuthResDetailService{
@Autowired
......
......@@ -122,18 +122,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
//页面数量(包括启用和未启用)
int count = appletCustomPageService.count(enterpriseId, appType, appId, pageType);
boolean isCouponOrMemberCenterPage = pageType == AppletPageTypeEnum.MEMBER_CENTER.getCode() || pageType == AppletPageTypeEnum.CARD_DETAIL_LIST.getCode();
if (isCouponOrMemberCenterPage) {
//如果是卡券或者会员中心
if (isAddOperation && count >= 5) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面超过5个");
}
}
if (AppletPageTypeEnum.INTEGRAL_SERVICE.getCode() == pageType) {
if (isAddOperation && count >= 15) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面超过15个");
}
}
validPageNumberLimit(pageType, count, isAddOperation);
//如果是有默认数据的类型(会员中心),第一条记录,即使saveType = 2,也自动变成1
if (AppletPageTypeEnum.hasDefault(pageType)) {
......@@ -398,7 +387,8 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
if (!AppletPageTypeEnum.needCrowdWidget(record.getPageType())) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面种类错误,该页面没有序号");
}
if (serialNumber > 999) {
boolean serialNumberLimit = serialNumber > 999;
if (serialNumberLimit) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "序号不能超过999");
}
record.setSerialNumber(serialNumber);
......@@ -571,10 +561,28 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
return;
}
List<TabAppletCustomPage> integralServiceList = getPageListByAppId(enterpriseId, appType, appId, AppletPageTypeEnum.INTEGRAL_SERVICE.getCode());
if (integralServiceList != null && integralServiceList.size() >= 15) {
boolean pageNumberLimit = integralServiceList != null && integralServiceList.size() >= 15;
if (pageNumberLimit) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "积分服务页面只能开启15个");
}
}
}
private void validPageNumberLimit(Integer pageType, Integer existPageCount, boolean isAddOperation) {
boolean isCouponOrMemberCenterPage = pageType == AppletPageTypeEnum.MEMBER_CENTER.getCode() || pageType == AppletPageTypeEnum.CARD_DETAIL_LIST.getCode();
if (isCouponOrMemberCenterPage) {
//如果是卡券或者会员中心
boolean pageNumValid = isAddOperation && existPageCount >= 5;
if (pageNumValid) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面超过5个");
}
}
if (AppletPageTypeEnum.INTEGRAL_SERVICE.getCode() == pageType) {
boolean pageNumValid = isAddOperation && existPageCount >= 15;
if (pageNumValid) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "页面超过15个");
}
}
}
}
......@@ -334,9 +334,9 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
List<Integer> auditorList = new ArrayList<>();
boolean isNeedSearchAuditor = !auditLogQO.isAdminUser() && auditLogQO.getSearchType() != null && auditLogQO.getSearchType() == 2;
if (isNeedSearchAuditor){
ServiceResponse<AuditorDTO> auditorDTOServiceResponse = auditorApiService.getAuditorByUserId(auditLogQO.getEnterpriseId(), auditLogQO.getUserId());
if (auditorDTOServiceResponse.isSuccess()) {
AuditorDTO auditorDTO = auditorDTOServiceResponse.getResult();
ServiceResponse<AuditorDTO> auditorDtoServiceResponse = auditorApiService.getAuditorByUserId(auditLogQO.getEnterpriseId(), auditLogQO.getUserId());
if (auditorDtoServiceResponse.isSuccess()) {
AuditorDTO auditorDTO = auditorDtoServiceResponse.getResult();
if (auditorDTO != null) {
auditorList.add(auditorDTO.getAuditorId());
}
......
......@@ -37,7 +37,13 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:03 AM

*/
@Service("customSettingApiService")
public class CustomSettingApiServiceImpl implements CustomSettingApiService {
private static final Logger log = LogManager.getLogger(CustomSettingApiServiceImpl.class);
......@@ -231,20 +237,21 @@ public class CustomSettingApiServiceImpl implements CustomSettingApiService {
private List<Criteria> getCriteriaList(Map<String, Object> map, TabTableSetting tableSetting){
List<TableSettingFieldDTO> fieldDTOS = tableSettingFieldService.listTableField(tableSetting.getTableId());
Map<String, TableSettingFieldDTO> fieldDTOMap = fieldDTOS.stream().collect(Collectors.toMap(TableSettingFieldDTO::getFieldKey, TableSettingFieldDTO -> TableSettingFieldDTO));
Map<String, TableSettingFieldDTO> fieldDtoMap = fieldDTOS.stream().collect(Collectors.toMap(TableSettingFieldDTO::getFieldKey, TableSettingFieldDTO -> TableSettingFieldDTO));
List<Criteria> criteriaList = new ArrayList<>();
map.forEach((k, v) -> {
Criteria criteria = null;
if(k.equals(PRIMARYKEY)){
criteria = Criteria.where(k).eq(v);
} else {
if(fieldDTOMap.get(k).getFieldType().equals(FieldTypeEnum.STRING.getType())){
if(fieldDtoMap.get(k).getFieldType().equals(FieldTypeEnum.STRING.getType())){
criteria = Criteria.where(k).regex(v);
} else if(fieldDTOMap.get(k).getFieldType().equals(FieldTypeEnum.DATE.getType())){
} else if(fieldDtoMap.get(k).getFieldType().equals(FieldTypeEnum.DATE.getType())){
String s = v+"";
if(StringUtils.isNotBlank(s)){
String[] split = s.split(",");
if(split.length == 2){
boolean isDateStrLength = split.length == 2;
if(isDateStrLength){
Map<String, Object> json = new HashMap();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
......
......@@ -64,7 +64,7 @@ public class DownloadReportApiServiceImpl implements DownloadReportApiService {
@Autowired
private Config config;
private static final String reportKey = "enterprise:report";
private static final String REPORT_KEY = "enterprise:report";
ScheduledExecutorService checkReportHeart = new ScheduledThreadPoolExecutor(1,
new BasicThreadFactory.Builder().namingPattern("reportHeartTimer-%d").daemon(true).build());
......@@ -74,7 +74,7 @@ public class DownloadReportApiServiceImpl implements DownloadReportApiService {
@Override
public void run() {
try {
RMap<Object, Object> map = RedisUtil.getRedisClient().getMap(reportKey);
RMap<Object, Object> map = RedisUtil.getRedisClient().getMap(REPORT_KEY);
log.info("监测心跳数据:{}", JSON.toJSONString(map));
if(MapUtils.isNotEmpty(map)){
Iterator<Object> iterator = map.keySet().iterator();
......@@ -133,7 +133,8 @@ public class DownloadReportApiServiceImpl implements DownloadReportApiService {
DateUtil.dateToStr(downloadReportDTO.getReportEndTime(), DateUtil.FORMAT_DATE_10);
downloadReportDTO.setFileName(fileName);
}
if("hive".equals(downloadReportDTO.getDataSource())){
String hiveOfDataSource = "hive";
if(hiveOfDataSource.equals(downloadReportDTO.getDataSource())){
downloadReportDTO.setStatus(DownloadReportStatusEnum.WAITLINE.getCode());
} else {
//sdk下载没有任务队列 直接生成中状态
......@@ -256,7 +257,7 @@ public class DownloadReportApiServiceImpl implements DownloadReportApiService {
@Override
public ServiceResponse<Void> receiveHeart(Integer reportId) {
log.info("接受心跳包:{}", reportId);
RMap<Object, Object> map = RedisUtil.getRedisClient().getMap(reportKey);
RMap<Object, Object> map = RedisUtil.getRedisClient().getMap(REPORT_KEY);
map.put(reportId, System.currentTimeMillis());
return ServiceResponse.success();
}
......
......@@ -39,7 +39,13 @@ import java.util.Date;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 数据处理
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:04 AM

*/
@Service("hiveDataDownloadApiService")
public class HiveDataDownloadApiServiceImpl implements HiveDataDownloadApiService {
private static final Logger log = LogManager.getLogger(HiveDataDownloadApiServiceImpl.class);
......@@ -228,7 +234,7 @@ public class HiveDataDownloadApiServiceImpl implements HiveDataDownloadApiServic
boolean hasEnterpriseIdFilter = false;
for(HiveQueryCondition condition: queryConditionList){
if(condition.getFieldFilterOptEnum() != null){
if(condition.getFieldName().equals("enterprise_id") || condition.getFieldName().equals("ent_id")){
if("enterprise_id".equals(condition.getFieldName()) || "ent_id".equals(condition.getFieldName())){
hasEnterpriseIdFilter = true;
}
sql.append(" and ").append(condition.getFieldName()).append(" ").append(condition.getFieldFilterOptEnum().getOpt());
......
......@@ -17,7 +17,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:59 AM

*/
@Service("tableSettingApiService")
public class TableSettingApiServiceImpl implements TableSettingApiService {
@Autowired
......
......@@ -133,7 +133,8 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
if (tabEnterprise.getServiceStatus() == 0) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户无服务");
}
if (tabEnterprise.getServiceStatus() == 2) {
boolean enterpriseStopStatus = tabEnterprise.getServiceStatus() == 2;
if (enterpriseStopStatus) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户已停用");
}
......@@ -211,7 +212,7 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
}
//todo 重新授权
//门店资源
if (UnionEnterpriseAuthResTypeEnum.STORE.getCode() == resourceType) {
if (UnionEnterpriseAuthResTypeEnum.STORE.getCode().equals(resourceType)) {
String authKey = detail.getAuthKey();
storeAuthorizationApiService.reAuthStore(authKey);
}
......@@ -591,18 +592,18 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
/**
* 通过时间秒毫秒数判断两个时间的间隔
* @param date1
* @param date2
* @param dateOne
* @param dateTwo
* @return
*/
private static int differentDaysByMillisecond(Date date1, Date date2) {
private static int differentDaysByMillisecond(Date dateOne, Date dateTwo) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
long startDateTime = 0;
long endDateTime = 0;
try {
startDateTime = dateFormat.parse(dateFormat.format(date1)).getTime();
endDateTime= dateFormat.parse(dateFormat.format(date2)).getTime();
startDateTime = dateFormat.parse(dateFormat.format(dateOne)).getTime();
endDateTime= dateFormat.parse(dateFormat.format(dateTwo)).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
......
......@@ -11,7 +11,13 @@ import java.sql.SQLException;
import java.sql.Types;
import java.text.SimpleDateFormat;
import java.util.List;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:03 AM

*/
public class CsvResultSetHelper implements ResultSetHelper {
private static final Logger log = LogManager.getLogger(CsvResultSetHelper.class);
/** 数据过滤模式 */
......@@ -64,7 +70,7 @@ public class CsvResultSetHelper implements ResultSetHelper {
result = new String[columnCount];
for (int i=0; i<columnCount; i++) {
String columnName = resultSet.getMetaData().getColumnLabel(i + 1);
if(dataType == DownloadReportDataTypeEnum.DESENSITIZATION_DATA.getCode()){
if(dataType.equals(DownloadReportDataTypeEnum.DESENSITIZATION_DATA.getCode())){
//如果是脱敏数据
if(filters.contains(columnName)){
result[i] = "******";
......
......@@ -7,6 +7,7 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
import com.gic.commons.annotation.SkipNamingCheck;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -20,14 +21,14 @@ import org.apache.logging.log4j.Logger;
*/
public class ExecutorPoolSingleton {
private Logger logger = LogManager.getLogger(ExecutorPoolSingleton.class);
private static final int availableProcessor = Runtime.getRuntime().availableProcessors();
private static final int AVAILABLE_PROCESSOR = Runtime.getRuntime().availableProcessors();
private static ExecutorService executorService;
private ExecutorPoolSingleton() {
if (executorService == null) {
int coreNum = availableProcessor / 2;
int coreNum = AVAILABLE_PROCESSOR / 2;
// 用单例模式创建线程池,保留2个核心线程,最多线程为CPU个数的2n+1的两倍.
int maxProcessor = (availableProcessor * 2 + 1) * 2 ;
int maxProcessor = (AVAILABLE_PROCESSOR * 2 + 1) * 2 ;
executorService = new ThreadPoolExecutor(coreNum > 2 ? 2 : coreNum, maxProcessor,
60L, TimeUnit.SECONDS,
......
......@@ -23,7 +23,13 @@ import java.sql.Types;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:04 AM

*/
public class FileUtils {
/** csv / xls 下载目录 */
public static final String SAVE_FOLDER = "/usr/local/data-hook-file";
......
......@@ -10,7 +10,13 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:48 AM

*/
public class HiveConnUtils {
private static final Logger log = LogManager.getLogger(HiveConnUtils.class);
private static String driverName = "org.apache.hive.jdbc.HiveDriver";
......@@ -35,11 +41,12 @@ public class HiveConnUtils {
}
public static Connection getConnnection(String url, String user, String password){
int timeout = 10;
try {
String key = url + ":" + user;
Connection connection = conCache.get(key);
if(connection != null){
if(connection.isValid(10)){
if(connection.isValid(timeout)){
return connection;
}
}
......
......@@ -109,13 +109,13 @@ public class DownloadReportController {
queryCondition.setFieldName("order_id");
queryCondition.setFieldMark("订单号");
list.add(queryCondition);
HiveQueryCondition queryCondition1 = new HiveQueryCondition();
queryCondition1.setFieldName("enterprise_id");
queryCondition1.setFieldMark("企业id");
queryCondition1.setFieldFilterOptEnum(FieldFilterOptEnum.EQ);
queryCondition1.setFieldTypeEnum(FieldTypeEnum.STRING);
queryCondition1.setFilterValue(Arrays.asList("ff8080816a36326c016a53380d8b5f52"));
list.add(queryCondition1);
HiveQueryCondition hiveQueryCondition = new HiveQueryCondition();
hiveQueryCondition.setFieldName("enterprise_id");
hiveQueryCondition.setFieldMark("企业id");
hiveQueryCondition.setFieldFilterOptEnum(FieldFilterOptEnum.EQ);
hiveQueryCondition.setFieldTypeEnum(FieldTypeEnum.STRING);
hiveQueryCondition.setFilterValue(Arrays.asList("ff8080816a36326c016a53380d8b5f52"));
list.add(hiveQueryCondition);
dataDownloadDTO.setQueryConditionList(list);
ServiceResponse<Integer> downloadTask = hiveDataDownloadApiService.createDownloadTask(dataDownloadDTO);
if(downloadTask.isSuccess()){
......
......@@ -398,12 +398,15 @@ public class IndexModuleController {
case ACU:
areaDataList = getAreaData(userId, enterpriseId, CuTypeEnum.ACU);
param.setAppletIdList(areaDataList.stream().mapToLong(e -> Long.valueOf(e.getMbrAreaId())).boxed().collect(Collectors.toList()));
break;
case MCU:
areaDataList = getAreaData(userId, enterpriseId, CuTypeEnum.MCU);
param.setMemberCardIdList(areaDataList.stream().mapToLong(e -> Long.valueOf(e.getMbrAreaId())).boxed().collect(Collectors.toList()));
break;
case SCU:
areaDataList = getAreaData(userId, enterpriseId, CuTypeEnum.SCU);
param.setServiceIdList(areaDataList.stream().mapToLong(e -> Long.valueOf(e.getMbrAreaId())).boxed().collect(Collectors.toList()));
break;
default:
areaDataList = getAreaData(userId, enterpriseId, CuTypeEnum.MCU);
param.setMemberCardIdList(areaDataList.stream().mapToLong(e -> Long.valueOf(e.getMbrAreaId())).boxed().collect(Collectors.toList()));
......
......@@ -520,7 +520,8 @@ public class UnionEnterpriseAuthController {
@RequestMapping("get-own-enterprise-app-resource-detail")
public RestResponse getOwnEnterpriseAppResourceDetail(Integer ownEnterpriseId) {
RestResponse result = getAppStrategy(ownEnterpriseId, UserDetailUtils.getUserDetail().getEnterpriseId());
if ("0000".equals(result.getCode())) {
boolean successResult = "0000".equals(result.getCode());
if (successResult) {
List<UnionAppResourceListVO> appStrategyList = (List<UnionAppResourceListVO>) result.getResult();
List<OwnEnterpriseAuthAppDetailVO> voList = new ArrayList<>();
......@@ -662,7 +663,8 @@ public class UnionEnterpriseAuthController {
//用户域数据
Map<Integer, Object> areaMap = new HashMap<>();
RestResponse userArea = channelResource(old.getResourceGroupId(), unionEnterpriseId, ownEnterpriseId);
if ("0000".equals(userArea.getCode())) {
boolean successResult = "0000".equals(userArea.getCode());
if (successResult) {
areaMap = (Map<Integer, Object>) userArea.getResult();
}
......
......@@ -21,7 +21,7 @@ public class DataContentUtils {
@Autowired
public void setMenuApiService(MenuApiService menuApiService) {
this.menuApiService = menuApiService;
DataContentUtils.menuApiService = menuApiService;
}
public static String getDataContent() {
......
......@@ -124,4 +124,18 @@ public class AppletServiceConfigVO implements Serializable{
this.image = image;
return this;
}
@Override
public String toString() {
return "AppletServiceConfigVO{" +
"appletServiceId=" + appletServiceId +
", enterpriseId=" + enterpriseId +
", appId='" + appId + '\'' +
", name='" + name + '\'' +
", type=" + type +
", createTime=" + createTime +
", updateTime=" + updateTime +
", image='" + image + '\'' +
'}';
}
}
......@@ -143,7 +143,8 @@ public class DownloadLogVO implements Serializable{
}
public Integer getDataType() {
if (dataType != null && dataType == 3) {
boolean isQrcodeType = dataType != null && dataType == 3;
if (isQrcodeType) {
//如果是二维码,则变成完整数据类型
return 1;
}
......
......@@ -218,7 +218,8 @@ public class DownloadReportVO implements Serializable{
}
public Integer getDataType() {
if (dataType != null && dataType == 3) {
boolean isQrcodeType = dataType != null && dataType == 3;
if (isQrcodeType) {
//如果是二维码,则变成完整数据类型
return 1;
}
......
......@@ -94,7 +94,8 @@ public class ChannelUserRateVO implements Serializable{
}
public Integer getMcuCount() {
if (mcuCount == null && cuType != null && cuType ==3) {
boolean isMcuType = mcuCount == null && cuType != null && cuType ==3;
if (isMcuType) {
return memberCount;
}
return mcuCount;
......@@ -118,7 +119,8 @@ public class ChannelUserRateVO implements Serializable{
}
public Integer getScuCount() {
if (scuCount == null && cuType != null && cuType ==2) {
boolean isScuType = scuCount == null && cuType != null && cuType ==2;
if (isScuType) {
return memberCount;
}
return scuCount;
......
......@@ -12,7 +12,13 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
/**
* 配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:48 AM

*/
@Controller
public class CustomSettingController {
@Autowired
......
......@@ -18,7 +18,13 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 10:02 AM

*/
@Controller
public class TableSettingController {
@Autowired
......
......@@ -4,7 +4,11 @@ import java.io.Serializable;
import java.util.Date;
/**
* tab_table_setting_field
* 增删改查自动生成配置
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/7/27 9:59 AM

*/
public class TableSettingFieldQO implements Serializable {
/**
......@@ -97,4 +101,17 @@ public class TableSettingFieldQO implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "TableSettingFieldQO{" +
"fieldId=" + fieldId +
", tableId=" + tableId +
", fieldKey='" + fieldKey + '\'' +
", fieldName='" + fieldName + '\'' +
", fieldType='" + fieldType + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment