main
ic_excellent 2023-03-18 04:16:38 +08:00
parent 7bd5d5b782
commit 50b8582287
25 changed files with 927 additions and 21 deletions

View File

@ -124,6 +124,7 @@ public class YearReviewController {
try{ try{
log.info("into getWorkflowTop success params ==> "+param); log.info("into getWorkflowTop success params ==> "+param);
User loginUser = HrmUserVarify.getUser(request, response); User loginUser = HrmUserVarify.getUser(request, response);
loginUser.setLoginid("9");
param.put("workflowIds",workflowIds); param.put("workflowIds",workflowIds);
if(!param.containsKey("limit")){ if(!param.containsKey("limit")){
param.put("limit",3); param.put("limit",3);

View File

@ -4,12 +4,10 @@ import aiyh.utils.Util;
import aiyh.utils.annotation.ActionDesc; import aiyh.utils.annotation.ActionDesc;
import aiyh.utils.annotation.PrintParamMark; import aiyh.utils.annotation.PrintParamMark;
import aiyh.utils.annotation.RequiredMark; import aiyh.utils.annotation.RequiredMark;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils; import aiyh.utils.httpUtil.util.HttpUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.api.bokang.xiao.dz_invoice.mapper.DzInvoiceMapper; import com.api.bokang.xiao.dz_invoice.mapper.DzInvoiceMapper;
import lombok.Data;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import weaver.interfaces.schedule.BaseCronJob; import weaver.interfaces.schedule.BaseCronJob;
import weaver.xiao.commons.config.entity.RequestMappingConfig; import weaver.xiao.commons.config.entity.RequestMappingConfig;
@ -28,7 +26,6 @@ import java.util.Objects;
**/ **/
@ActionDesc(value = "定时查询发票勾选状态", author = "bokang.xiao") @ActionDesc(value = "定时查询发票勾选状态", author = "bokang.xiao")
@Data
public class InvoiceQuerySchedule extends BaseCronJob { public class InvoiceQuerySchedule extends BaseCronJob {
@RequiredMark("发票查询接口唯一标识") @RequiredMark("发票查询接口唯一标识")

View File

@ -0,0 +1,38 @@
package weaver.bokang.xiao.xhny_report.entity;
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
import lombok.Data;
/**
* @ClassName CompanyEntity
* @Author
* @Date 2023/3/17 18:10
* @Description <h1></h1>
**/
@Data
public class CompanyEntity {
private Integer id;
/** 起订要求 */
@SqlDbFieldAnn("fs")
private String orderRequire;
/** 退换货条件 */
@SqlDbFieldAnn("thtk")
private Integer returnAndExchange;
/** 配送周期 */
@SqlDbFieldAnn("csshsx")
private Integer deliveryCycle;
/** 账期 */
@SqlDbFieldAnn("zqxlk")
private Integer accountPeriod;
/** 装卸(分拣)服务 */
@SqlDbFieldAnn("sftgfjfw")
private Integer sortingService;
}

View File

@ -0,0 +1,39 @@
package weaver.bokang.xiao.xhny_report.entity;
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
import lombok.Data;
/**
* @ClassName ConfigEntity
* @Author
* @Date 2023/3/16 10:50
* @Description <h1></h1>
**/
@Data
public class ConfigEntity {
/** 数据id */
private Integer id;
/** 分数 */
@SqlDbFieldAnn("fs")
private Double score;
/** 子项目 */
@SqlDbFieldAnn("zxm")
private Integer childItem;
/** 明细 */
@SqlDbFieldAnn("mx")
private String detail;
/** 权重 */
@SqlDbFieldAnn("qz")
private String weight;
/** 明细项 */
@SqlDbFieldAnn("fs")
private Integer detailItem;
}

View File

@ -0,0 +1,18 @@
package weaver.bokang.xiao.xhny_report.entity;
import lombok.Data;
import java.util.List;
/**
* @ClassName SourceTrackingData
* @Author
* @Date 2023/3/17 15:19
* @Description <h1></h1>
**/
@Data
public class SourceTrackingData {
private List<String> vendorList;
}

View File

@ -0,0 +1,44 @@
package weaver.bokang.xiao.xhny_report.entity;
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
import lombok.Data;
import java.util.List;
/**
* @ClassName VendorMarkReport
* @Author
* @Date 2023/3/16 13:47
* @Description <h1></h1>
**/
@Data
public class VendorMarkReport {
/** 数据id */
private Integer id;
/** 评估开始时间 */
@SqlDbFieldAnn("pgksrq")
private String evaluationStartDate;
/** 评估结束时间 */
@SqlDbFieldAnn("pgjsrq")
private String evaluationEndDate;
/** 供应商 */
@SqlDbFieldAnn("gys")
private Integer supplier;
/** 品类 */
@SqlDbFieldAnn("pl")
private String category;
/** 本期总分 */
@SqlDbFieldAnn("bqzf")
private double totalScore;
/** 分数明细信息 */
private List<VendorMarkReportDt> vendorMarkReportDtList;
}

View File

@ -0,0 +1,44 @@
package weaver.bokang.xiao.xhny_report.entity;
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
import lombok.Builder;
import lombok.Data;
/**
* @ClassName VendorMarkReportDt
* @Author
* @Date 2023/3/16 13:56
* @Description <h1></h1>
**/
@Data
@Builder
public class VendorMarkReportDt {
/** 数据id */
private Integer id;
/** 主数据id */
private Integer mainId;
/** 项目 */
@SqlDbFieldAnn("xm")
private Integer project;
/** 描述 */
@SqlDbFieldAnn("ms")
private String desc;
/** 权重 */
@SqlDbFieldAnn("qz")
private String weight;
/** 预估得分 */
@SqlDbFieldAnn("ygdf")
private String anticipateScore;
/** 实际得分 */
@SqlDbFieldAnn("sjdf")
private Double score;
}

View File

@ -0,0 +1,33 @@
package weaver.bokang.xiao.xhny_report.mapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import weaver.bokang.xiao.xhny_report.entity.CompanyEntity;
import weaver.bokang.xiao.xhny_report.entity.ConfigEntity;
import java.util.List;
/**
* @ClassName VendorMapper
* @Author
* @Date 2023/3/16 14:13
* @Description <h1></h1>
**/
@SqlMapper
public interface VendorMapper {
/**
* <h2></h2>
* @return
*/
@Select("select * from uf_vendorMark")
List<ConfigEntity> queryVendorConfig();
/**
*
* @return
*/
@Select("select * from uf_company_info")
List<CompanyEntity> queryCompanyList();
}

View File

@ -0,0 +1,56 @@
package weaver.bokang.xiao.xhny_report.schedule;
import aiyh.utils.Util;
import aiyh.utils.annotation.ActionDesc;
import aiyh.utils.annotation.PrintParamMark;
import aiyh.utils.annotation.RequiredMark;
import lombok.Data;
import org.apache.log4j.Logger;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import weaver.bokang.xiao.xhny_report.service.ScoreChainPattern;
import weaver.bokang.xiao.xhny_report.service.chain.AbstractScoreChain;
import weaver.bokang.xiao.xhny_report.service.store.VendorStore;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName GenerateReportSchedule
* @Author
* @Date 2023/3/17 19:58
* @Description <h1></h1>
**/
@Data
@ActionDesc(value = "生成报表信息", author = "bokang.xiao")
public class GenerateReportSchedule extends BaseCronJob {
private final Logger log = Util.getLogger();
@RequiredMark("报表模块id")
@PrintParamMark
private String reportModelId;
@Override
public void execute() {
try {
//必填参数校验
Util.verifyRequiredField(this);
//公共参数初始化
VendorStore instance = VendorStore.getInstance();
instance.init();
//获取评分处理链
AbstractScoreChain scoreChain = ScoreChainPattern.getScoreChain();
//处理数据初始化
List<VendorMarkReport> vendorMarkReportList = new ArrayList<>();
SourceTrackingData sourceTrackingData = new SourceTrackingData();
//进行供应商评分
scoreChain.handle(vendorMarkReportList, sourceTrackingData);
//批量插入供应商报表数据
//todo 批量插入供应商报表数据
}catch (Exception e){
log.error("定时任务执行异常 ==>"+Util.getErrString(e));
}
}
}

View File

@ -0,0 +1,74 @@
package weaver.bokang.xiao.xhny_report.service;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSON;
import org.apache.log4j.Logger;
import weaver.bokang.xiao.xhny_report.entity.ConfigEntity;
import weaver.bokang.xiao.xhny_report.mapper.VendorMapper;
import weaver.bokang.xiao.xhny_report.service.chain.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @ClassName ScoreChainPattern
* @Author
* @Date 2023/3/17 16:13
* @Description <h1></h1>
**/
public class ScoreChainPattern {
private static final VendorMapper VENDOR_MAPPER = Util.getMapper(VendorMapper.class);
private static final Logger logger = Util.getLogger();
private static final Map<Integer, AbstractScoreChain> SCORE_CHAIN_MAP = new HashMap<>();
static {
SCORE_CHAIN_MAP.put(0,new OrderRequirementChain());
SCORE_CHAIN_MAP.put(1,new ReturnAndExchangeChain());
SCORE_CHAIN_MAP.put(2,new DeliveryCycleChain());
SCORE_CHAIN_MAP.put(3,new AccountPeriodChain());
SCORE_CHAIN_MAP.put(4,new QuotationNumberChain());
SCORE_CHAIN_MAP.put(5,new MoneyAmountChain());
SCORE_CHAIN_MAP.put(6,new TopThirtyChain());
SCORE_CHAIN_MAP.put(7,new QuotationCompleteChain());
SCORE_CHAIN_MAP.put(8,new QuotationTimeChain());
SCORE_CHAIN_MAP.put(9,new ArrivalRateChain());
SCORE_CHAIN_MAP.put(10,new BadCountChain());
SCORE_CHAIN_MAP.put(11,new SortingServiceChain());
}
public static AbstractScoreChain getScoreChain(){
List<ConfigEntity> configEntities = VENDOR_MAPPER.queryVendorConfig();
if(configEntities.isEmpty()){
throw new CustomerException("评分配置信息不能为空");
}
logger.info(String.format("评分配置信息: < %s >", JSON.toJSONString(configEntities)));
Map<Integer, List<ConfigEntity>> configMap = configEntities.stream().collect(Collectors.groupingBy(ConfigEntity::getChildItem));
AbstractScoreChain abstractScoreChain = null;
for (Map.Entry<Integer, List<ConfigEntity>> entry : configMap.entrySet()) {
AbstractScoreChain tempChain = SCORE_CHAIN_MAP.get(entry.getKey());
if(Objects.isNull(tempChain)){
logger.error(String.format("无法找到与之 %d 对应的链路处理对象",entry.getKey()));
continue;
}
if(Objects.isNull(abstractScoreChain)){
abstractScoreChain = SCORE_CHAIN_MAP.get(entry.getKey());
abstractScoreChain.setScoreConfigList(entry.getValue());
}else {
AbstractScoreChain nexChain = SCORE_CHAIN_MAP.get(entry.getKey());
nexChain.setScoreConfigList(entry.getValue());
abstractScoreChain.nextScoreChain(nexChain);
}
}
if(Objects.isNull(abstractScoreChain)){
throw new CustomerException("链路调用对象初始化为空,请检查");
}
return abstractScoreChain;
}
}

View File

@ -0,0 +1,61 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import aiyh.utils.Util;
import org.apache.log4j.Logger;
import weaver.bokang.xiao.xhny_report.entity.ConfigEntity;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import weaver.bokang.xiao.xhny_report.service.store.VendorStore;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @ClassName AbstractScoreChain
* @Author
* @Date 2023/3/17 14:59
* @Description <h1></h1>
**/
public abstract class AbstractScoreChain {
/** 日志对象 */
protected Logger logger = Util.getLogger();
/** 评分配置列表 */
protected List<ConfigEntity> scoreConfigList;
/** 评分配置信息集合 */
protected Map<Integer,ConfigEntity> configEntityMap;
/** 公共数据信息 */
protected VendorStore vendorStore = VendorStore.getInstance();
/** 责任链中的下一个元素 */
protected AbstractScoreChain nextAbstractScoreChain;
/**
* <h2></h2>
* @param abstractScoreChain
*/
public void nextScoreChain(AbstractScoreChain abstractScoreChain){
this.nextAbstractScoreChain = abstractScoreChain;
}
/**
* <h2></h2>
* @param scoreConfigList
*/
public void setScoreConfigList(List<ConfigEntity> scoreConfigList){
this.scoreConfigList = scoreConfigList;
this.configEntityMap = scoreConfigList.stream().collect(Collectors.toMap(ConfigEntity::getDetailItem, item -> item));
}
/**
* <h2></h2>
* @param vendorMarkReportList
* @param sourceTrackingData
*/
abstract public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData);
}

View File

@ -0,0 +1,54 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.*;
import java.util.*;
/**
* @ClassName AccountPeriodChain
* @Author
* @Date 2023/3/17 15:33
* @Description <h1></h1>
**/
public class AccountPeriodChain extends AbstractScoreChain{
/** 评分对应关系 */
private final Map<Integer,Integer> mappingConfig = new HashMap<>();
{
mappingConfig.put(0,14);
mappingConfig.put(1,15);
mappingConfig.put(2,16);
mappingConfig.put(3,17);
}
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//具体评分逻辑
logger.info(" AccountPeriodChain deal 账期评分处理 ");
Map<Integer, CompanyEntity> companyMap = vendorStore.getCompanyMap();
for (VendorMarkReport vendorMarkReport : vendorMarkReportList) {
Integer supplier = vendorMarkReport.getSupplier();
CompanyEntity companyEntity = companyMap.get(supplier);
ConfigEntity configEntity = this.configEntityMap.get(mappingConfig.get(companyEntity.getAccountPeriod()));
double score = 0.00;
if(Objects.nonNull(configEntity)){
score = configEntity.getScore();
}
List<VendorMarkReportDt> vendorMarkReportDtList = vendorMarkReport.getVendorMarkReportDtList();
vendorMarkReportDtList = Objects.isNull(vendorMarkReportDtList) ? new ArrayList<>() : vendorMarkReportDtList;
vendorMarkReportDtList.add(
VendorMarkReportDt.builder()
.score(score)
.project(configEntity.getChildItem())
.weight(configEntity.getWeight())
.desc("账期评分").build());
double totalScore = vendorMarkReport.getTotalScore();
vendorMarkReport.setTotalScore(totalScore + score);
}
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,26 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import java.util.List;
import java.util.Objects;
/**
* @ClassName ArrivalRateChain
* @Author
* @Date 2023/3/17 15:43
* @Description <h1></h1>
**/
public class ArrivalRateChain extends AbstractScoreChain{
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,25 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import java.util.List;
import java.util.Objects;
/**
* @ClassName BadCountChain
* @Author
* @Date 2023/3/17 15:45
* @Description <h1></h1>
**/
public class BadCountChain extends AbstractScoreChain{
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,59 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.*;
import java.util.*;
/**
* @ClassName DeliveryCycleChain
* @Author
* @Date 2023/3/17 15:32
* @Description <h1></h1>
**/
public class DeliveryCycleChain extends AbstractScoreChain{
/** 评分对应关系 */
private final Map<Integer,Integer> mappingConfig = new HashMap<>();
{
mappingConfig.put(0,5);
mappingConfig.put(1,6);
mappingConfig.put(2,7);
mappingConfig.put(3,8);
mappingConfig.put(4,9);
mappingConfig.put(5,10);
mappingConfig.put(6,11);
mappingConfig.put(7,12);
mappingConfig.put(8,13);
}
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//具体评分逻辑
logger.info(" DeliveryCycleChain deal 配送周期评分处理 ");
Map<Integer, CompanyEntity> companyMap = vendorStore.getCompanyMap();
for (VendorMarkReport vendorMarkReport : vendorMarkReportList) {
Integer supplier = vendorMarkReport.getSupplier();
CompanyEntity companyEntity = companyMap.get(supplier);
ConfigEntity configEntity = this.configEntityMap.get(mappingConfig.get(companyEntity.getDeliveryCycle()));
double score = 0.00;
if(Objects.nonNull(configEntity)){
score = configEntity.getScore();
}
List<VendorMarkReportDt> vendorMarkReportDtList = vendorMarkReport.getVendorMarkReportDtList();
vendorMarkReportDtList = Objects.isNull(vendorMarkReportDtList) ? new ArrayList<>() : vendorMarkReportDtList;
vendorMarkReportDtList.add(
VendorMarkReportDt.builder()
.score(score)
.project(configEntity.getChildItem())
.weight(configEntity.getWeight())
.desc("配送周期评分").build());
double totalScore = vendorMarkReport.getTotalScore();
vendorMarkReport.setTotalScore(totalScore + score);
}
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,25 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import java.util.List;
import java.util.Objects;
/**
* @ClassName MoneyAmountChain
* @Author
* @Date 2023/3/17 15:38
* @Description <h1></h1>
**/
public class MoneyAmountChain extends AbstractScoreChain{
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,55 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import org.apache.commons.lang3.StringUtils;
import weaver.bokang.xiao.xhny_report.entity.*;
import java.util.*;
/**
* @ClassName OrderRequirementChain
* @Author
* @Date 2023/3/17 15:27
* @Description <h1></h1>
**/
public class OrderRequirementChain extends AbstractScoreChain{
/** 评分对应关系 */
private final Map<Integer,Integer> mappingConfig = new HashMap<>();
{
mappingConfig.put(0,0);
mappingConfig.put(1,0);
}
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
logger.info(" OrderRequirementChain deal 起订要求评分处理 ");
Map<Integer, CompanyEntity> companyMap = vendorStore.getCompanyMap();
for (VendorMarkReport vendorMarkReport : vendorMarkReportList) {
Integer supplier = vendorMarkReport.getSupplier();
CompanyEntity companyEntity = companyMap.get(supplier);
int configEntityId = StringUtils.isNotBlank(companyEntity.getOrderRequire()) ? 0 : 1;
ConfigEntity configEntity = this.configEntityMap.get(mappingConfig.get(configEntityId));
double score = 0.00;
if(Objects.nonNull(configEntity)){
score = configEntity.getScore();
}
List<VendorMarkReportDt> vendorMarkReportDtList = vendorMarkReport.getVendorMarkReportDtList();
vendorMarkReportDtList = Objects.isNull(vendorMarkReportDtList) ? new ArrayList<>() : vendorMarkReportDtList;
vendorMarkReportDtList.add(
VendorMarkReportDt.builder()
.score(score)
.project(configEntity.getChildItem())
.weight(configEntity.getWeight())
.desc("起订要求评分").build());
double totalScore = vendorMarkReport.getTotalScore();
vendorMarkReport.setTotalScore(totalScore + score);
}
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,26 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import java.util.List;
import java.util.Objects;
/**
* @ClassName QuotationCompleteChain
* @Author
* @Date 2023/3/17 15:41
* @Description <h1></h1>
**/
public class QuotationCompleteChain extends AbstractScoreChain {
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,26 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import java.util.List;
import java.util.Objects;
/**
* @ClassName QuotationNumberChain
* @Author
* @Date 2023/3/17 15:35
* @Description <h1></h1>
**/
public class QuotationNumberChain extends AbstractScoreChain{
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,26 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import java.util.List;
import java.util.Objects;
/**
* @ClassName QuotationTimeChain
* @Author
* @Date 2023/3/17 15:42
* @Description <h1></h1>
**/
public class QuotationTimeChain extends AbstractScoreChain{
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,53 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.*;
import java.util.*;
/**
* @ClassName ReturnAndExchangeChain
* @Author
* @Date 2023/3/17 15:31
* @Description <h1>退</h1>
**/
public class ReturnAndExchangeChain extends AbstractScoreChain{
/** 评分对应关系 */
private final Map<Integer,Integer> mappingConfig = new HashMap<>();
{
mappingConfig.put(0,2);
mappingConfig.put(1,3);
mappingConfig.put(2,4);
}
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//具体评分逻辑
logger.info(" ReturnAndExchangeChain deal 退换货评分处理 ");
Map<Integer, CompanyEntity> companyMap = vendorStore.getCompanyMap();
for (VendorMarkReport vendorMarkReport : vendorMarkReportList) {
Integer supplier = vendorMarkReport.getSupplier();
CompanyEntity companyEntity = companyMap.get(supplier);
ConfigEntity configEntity = this.configEntityMap.get(mappingConfig.get(companyEntity.getReturnAndExchange()));
double score = 0.00;
if(Objects.nonNull(configEntity)){
score = configEntity.getScore();
}
List<VendorMarkReportDt> vendorMarkReportDtList = vendorMarkReport.getVendorMarkReportDtList();
vendorMarkReportDtList = Objects.isNull(vendorMarkReportDtList) ? new ArrayList<>() : vendorMarkReportDtList;
vendorMarkReportDtList.add(
VendorMarkReportDt.builder()
.score(score)
.project(configEntity.getChildItem())
.weight(configEntity.getWeight())
.desc("退换货评分").build());
double totalScore = vendorMarkReport.getTotalScore();
vendorMarkReport.setTotalScore(totalScore + score);
}
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,52 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.*;
import java.util.*;
/**
* @ClassName SortingServiceChain
* @Author
* @Date 2023/3/17 15:46
* @Description <h1></h1>
**/
public class SortingServiceChain extends AbstractScoreChain{
/** 评分对应关系 */
private final Map<Integer,Integer> mappingConfig = new HashMap<>();
{
mappingConfig.put(0,38);
mappingConfig.put(1,39);
}
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//具体评分逻辑
logger.info(" SortingServiceChain deal 分拣服务评分处理 ");
Map<Integer, CompanyEntity> companyMap = vendorStore.getCompanyMap();
for (VendorMarkReport vendorMarkReport : vendorMarkReportList) {
Integer supplier = vendorMarkReport.getSupplier();
CompanyEntity companyEntity = companyMap.get(supplier);
ConfigEntity configEntity = this.configEntityMap.get(mappingConfig.get(companyEntity.getSortingService()));
double score = 0.00;
if(Objects.nonNull(configEntity)){
score = configEntity.getScore();
}
List<VendorMarkReportDt> vendorMarkReportDtList = vendorMarkReport.getVendorMarkReportDtList();
vendorMarkReportDtList = Objects.isNull(vendorMarkReportDtList) ? new ArrayList<>() : vendorMarkReportDtList;
vendorMarkReportDtList.add(
VendorMarkReportDt.builder()
.score(score)
.project(configEntity.getChildItem())
.weight(configEntity.getWeight())
.desc("分拣服务评分").build());
double totalScore = vendorMarkReport.getTotalScore();
vendorMarkReport.setTotalScore(totalScore + score);
}
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,26 @@
package weaver.bokang.xiao.xhny_report.service.chain;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.entity.VendorMarkReport;
import java.util.List;
import java.util.Objects;
/**
* @ClassName TopThirtyChain
* @Author
* @Date 2023/3/17 15:39
* @Description <h1>top30</h1>
**/
public class TopThirtyChain extends AbstractScoreChain{
@Override
public void handle(List<VendorMarkReport> vendorMarkReportList, SourceTrackingData sourceTrackingData) {
//TODO 具体评分逻辑
//让下一个链对象评分
if(Objects.nonNull(this.nextAbstractScoreChain)) {
this.nextAbstractScoreChain.handle(vendorMarkReportList, sourceTrackingData);
}
}
}

View File

@ -0,0 +1,59 @@
package weaver.bokang.xiao.xhny_report.service.store;
import aiyh.utils.Util;
import lombok.Getter;
import org.apache.log4j.Logger;
import weaver.bokang.xiao.xhny_report.entity.CompanyEntity;
import weaver.bokang.xiao.xhny_report.mapper.VendorMapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @ClassName VendorStore
* @Author
* @Date 2023/3/17 18:31
* @Description <h1></h1>
**/
@Getter
public class VendorStore {
/** 公司信息 */
private List<CompanyEntity> companyEntityList;
private Map<Integer,CompanyEntity> companyMap = new HashMap<>();
private static final Logger logger = Util.getLogger();
private static final VendorMapper VENDOR_MAPPER = Util.getMapper(VendorMapper.class);
private VendorStore(){
//this.init();
}
public void init(){
try{
this.companyEntityList = VENDOR_MAPPER.queryCompanyList();
if(Objects.nonNull(companyEntityList) && !companyEntityList.isEmpty()){
companyMap = companyEntityList.stream().collect(Collectors.toMap(CompanyEntity::getId, item -> item));
}
}catch (Exception exception){
logger.error("VendorStore 初始化异常 ==>"+Util.getErrString(exception));
}
}
public static VendorStore getInstance(){
return VendorStoreHolder.VENDOR_STORE;
}
private static class VendorStoreHolder{
private VendorStoreHolder(){
}
private static final VendorStore VENDOR_STORE = new VendorStore();
}
}

View File

@ -1,7 +1,6 @@
package bokang.xiao; package bokang.xiao;
import aiyh.utils.GenerateFileUtil; import aiyh.utils.GenerateFileUtil;
import aiyh.utils.ThreadPoolConfig;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils; import aiyh.utils.httpUtil.util.HttpUtils;
@ -9,46 +8,33 @@ import basetest.BaseTest;
import bokang.xiao.entity.CourseEntity; import bokang.xiao.entity.CourseEntity;
import bokang.xiao.entity.StudentEntity; import bokang.xiao.entity.StudentEntity;
import bokang.xiao.entity.TeacherEntity; import bokang.xiao.entity.TeacherEntity;
import bokang.xiao.mapper.TestMapper;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.api.bokang.xiao.porsche_review.mapper.ReviewMapper; import com.api.bokang.xiao.porsche_review.mapper.ReviewMapper;
import com.api.bokang.xiao.porsche_review.service.ReviewService;
import com.api.bokang.xiao.porsche_review.service.impl.ReviewServiceImpl; import com.api.bokang.xiao.porsche_review.service.impl.ReviewServiceImpl;
import com.api.bokang.xiao.wx_report.entity.ReportEntityVO;
import com.api.bokang.xiao.wx_report.mapper.ReportMapper; import com.api.bokang.xiao.wx_report.mapper.ReportMapper;
import com.api.bokang.xiao.wx_report.service.ReportService; import com.api.bokang.xiao.wx_report.service.ReportService;
import com.api.bokang.xiao.wx_report.service.impl.ReportServiceImpl; import com.api.bokang.xiao.wx_report.service.impl.ReportServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.poi.POIXMLDocument;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.junit.Test; import org.junit.Test;
import weaver.bokang.xiao.dz_invoice.action.InvoiceDeductionAction; import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.dz_invoice.schedule.InvoiceQuerySchedule; import weaver.bokang.xiao.xhny_report.service.chain.AbstractScoreChain;
import weaver.bokang.xiao.xhny_report.service.ScoreChainPattern;
import weaver.general.StaticObj; import weaver.general.StaticObj;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.interfaces.datasource.DataSource; import weaver.interfaces.datasource.DataSource;
import weaver.workflow.workflow.WorkflowVersion; import weaver.workflow.workflow.WorkflowVersion;
import weaver.xiao.commons.config.entity.ResponseMapping;
import weaver.xiao.commons.utils.DocImageFileUtil; import weaver.xiao.commons.utils.DocImageFileUtil;
import java.io.*; import java.io.*;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
/** /**
* @ClassName NormalTest * @ClassName NormalTest
@ -125,7 +111,10 @@ public class NormalTest extends BaseTest {
@Test @Test
public void testgg() throws IOException { public void testgg() throws IOException {
System.out.println(null instanceof Collections); //System.out.println(null instanceof Collections);
AbstractScoreChain scoreChain = ScoreChainPattern.getScoreChain();
scoreChain.handle(new ArrayList<>(),new SourceTrackingData());
System.out.println(scoreChain);
} }
@Test @Test