Browse Source

项目分类采集api

dev_shibei_match
yinzuomei 5 years ago
parent
commit
25f34e8c97
  1. 13
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java
  2. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java
  3. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java
  4. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java

13
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java

@ -1,11 +1,8 @@
package com.epmet.dto.screen.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 项目分类字典上报
@ -15,38 +12,31 @@ import java.math.BigDecimal;
@Data
public class CategoryDictFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
// public interface ExtractDailyForm extends CustomerClientShowGroup {}
private static final long serialVersionUID = 1245827825857891963L;
/**
* 客户内自己的分类编码
*/
// @NotBlank(message = "客户分类编码不能为空", groups = { ExtractDailyForm.class })
private String categoryCode;
/**
* 客户内自己的分类名称
*/
// @NotBlank(message = "客户分类名称不能为空", groups = { ExtractDailyForm.class })
private String categoryName;
/**
* 父类分类编码如果是一级分类此列赋值为0
*/
// @NotBlank(message = "父类分类编码不能为空", groups = { ExtractDailyForm.class })
private String parentCategoryCode;
/**
* 分类等级12....
*/
// @NotBlank(message = "分类等级不能为空", groups = { ExtractDailyForm.class })
private Integer level;
/**
* 排序
*/
// @NotBlank(message = "排序不能为空", groups = { ExtractDailyForm.class })
private Integer sort;
/**
@ -67,6 +57,5 @@ public class CategoryDictFormDTO implements Serializable {
/**
* 分类字典表主键
*/
// @NotBlank(message = "分类字典表主键不能为空", groups = { ExtractDailyForm.class })
private String categoryId;
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java

@ -163,8 +163,10 @@ public class ScreenProjectDataCollController {
* @Date 16:03 2021-03-22
**/
@PostMapping("uploadcategorydict")
public Result uploadcategorydict(@RequestHeader("CustomerId") String customerId, @RequestBody CategoryDictDataFormDTO formDTO) {
customerProjectCategoryDictService.uploadCategoryDict(customerId, formDTO);
public Result uploadcategorydict(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<CategoryDictFormDTO> formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class);
customerProjectCategoryDictService.uploadCategoryDict(formDTO);
return new Result();
}
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java

@ -18,7 +18,8 @@
package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.screen.CategoryDictDataFormDTO;
import com.epmet.dto.screen.form.CategoryDictFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.issue.IssueProjectCategoryDictEntity;
import com.epmet.entity.stats.CustomerProjectCategoryDictEntity;
@ -48,11 +49,10 @@ public interface CustomerProjectCategoryDictService extends BaseService<Customer
* 项目分类字典上报
* 目标表epmet_evaluation_index库的customer_project_category_dict
*
* @param customerId
* @param formDTO
* @return void
* @Author zhangyong
* @Date 16:03 2021-03-22
**/
void uploadCategoryDict(String customerId, CategoryDictDataFormDTO formDTO);
void uploadCategoryDict(ScreenCollFormDTO<CategoryDictFormDTO> formDTO);
}

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java

@ -22,14 +22,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.stats.CustomerProjectCategoryDictDao;
import com.epmet.dto.screen.CategoryDictDataFormDTO;
import com.epmet.dto.screen.form.CategoryDictFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.issue.IssueProjectCategoryDictEntity;
import com.epmet.entity.stats.CustomerProjectCategoryDictEntity;
import com.epmet.service.stats.CustomerProjectCategoryDictService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.collections4.CollectionUtils;
import java.util.List;
@ -97,18 +98,19 @@ public class CustomerProjectCategoryDictServiceImpl extends BaseServiceImpl<Cust
return baseDao.getLatestUpdatedEntity();
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void uploadCategoryDict(String customerId, CategoryDictDataFormDTO formDTO) {
public void uploadCategoryDict(ScreenCollFormDTO<CategoryDictFormDTO> formDTO) {
if (formDTO.getIsFirst()) {
int deleteNum;
do {
deleteNum = baseDao.deleteCustomerProjectCategoryDict(customerId);
deleteNum = baseDao.deleteCustomerProjectCategoryDict(formDTO.getCustomerId());
} while (deleteNum > NumConstant.ZERO);
}
if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
baseDao.batchInsertCustomerProjectCategoryDict(formDTO.getDataList(), customerId);
baseDao.batchInsertCustomerProjectCategoryDict(formDTO.getDataList(), formDTO.getCustomerId());
}
}
}

Loading…
Cancel
Save