Commit bdcdbf6d by huluobin

update

parent 3a519075
...@@ -25,6 +25,7 @@ import com.gogirl.domain.user.customer.Customer; ...@@ -25,6 +25,7 @@ import com.gogirl.domain.user.customer.Customer;
import com.gogirl.domain.user.customer.CustomerBalanceRecord; import com.gogirl.domain.user.customer.CustomerBalanceRecord;
import com.gogirl.domain.xcx.WeekConfig; import com.gogirl.domain.xcx.WeekConfig;
import com.gogirl.infrastructure.common.util.DateUtils; import com.gogirl.infrastructure.common.util.DateUtils;
import com.gogirl.infrastructure.common.util.JsonUtilByJackson;
import com.gogirl.infrastructure.common.util.ListUtil; import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.config.property.GogirlProperties; import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMapper; import com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMapper;
...@@ -46,14 +47,28 @@ import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMappe ...@@ -46,14 +47,28 @@ import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMappe
import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper; import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper;
import com.gogirl.infrastructure.service.push.PushMsgService; import com.gogirl.infrastructure.service.push.PushMsgService;
import com.gogirl.infrastructure.service.push.TechnicianPushService; import com.gogirl.infrastructure.service.push.TechnicianPushService;
import com.gogirl.shared.admin.AdminPage;
import com.gogirl.shared.admin.AdminResult;
import com.gogirl.shared.admin.AdminTechnicianScore;
import com.gogirl.shared.admin.GetTechnicianPageRequest;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -106,6 +121,8 @@ public class Schedule { ...@@ -106,6 +121,8 @@ public class Schedule {
private final TimesCardCustomerRelevanceMapper timesCardCustomerRelevanceMapper; private final TimesCardCustomerRelevanceMapper timesCardCustomerRelevanceMapper;
private final RestTemplate restTemplate;
/** /**
* 每天3点判断优惠券是否过期。 * 每天3点判断优惠券是否过期。
*/ */
...@@ -366,7 +383,7 @@ public class Schedule { ...@@ -366,7 +383,7 @@ public class Schedule {
/** /**
* 每天0点定时同步美甲师成长历程 * 每天0点定时同步美甲师成长历程
*/ */
@Scheduled(cron = "0 0 0 * * *") @Scheduled(cron = "0 0/1 * * * *")
public void syncTechnicianCareer() { public void syncTechnicianCareer() {
log.info("定时同步美甲师成长历程** 任务开始"); log.info("定时同步美甲师成长历程** 任务开始");
...@@ -376,50 +393,50 @@ public class Schedule { ...@@ -376,50 +393,50 @@ public class Schedule {
storeTechnicianList.forEach(storeTechnician -> { storeTechnicianList.forEach(storeTechnician -> {
// ParameterizedTypeReference<AdminResult<AdminPage<AdminTechnicianScore>>> responseBodyType = new ParameterizedTypeReference<AdminResult<AdminPage<AdminTechnicianScore>>>() { ParameterizedTypeReference<AdminResult<AdminPage<AdminTechnicianScore>>> responseBodyType = new ParameterizedTypeReference<AdminResult<AdminPage<AdminTechnicianScore>>>() {
// }; };
// GetTechnicianPageRequest allRequest = GetTechnicianPageRequest.builder() GetTechnicianPageRequest allRequest = GetTechnicianPageRequest.builder()
// .page(1) .page(1)
// .rows(30) .rows(30)
// .sidx("grade") .sidx("grade")
// .sord("asc") .sord("asc")
// //在职 //在职
// .status(1) .status(1)
// .technician_id(storeTechnician.getId()) .technician_id(storeTechnician.getId())
// .build(); .build();
// HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
// HttpEntity<GetTechnicianPageRequest> allHttpEntity = new HttpEntity<>(allRequest, headers); HttpEntity<GetTechnicianPageRequest> allHttpEntity = new HttpEntity<>(allRequest, headers);
// AdminTechnicianScore allAdminResult = restTemplate.exchange(gogirlProperties.getAdminBackendUrl(), HttpMethod.POST, allHttpEntity, responseBodyType) AdminTechnicianScore allAdminResult = restTemplate.exchange(gogirlProperties.getAdminBackendUrl(), HttpMethod.POST, allHttpEntity, responseBodyType)
// .getBody() .getBody()
// .getData() .getData()
// .getItems() .getItems()
// .stream() .stream()
// .findAny() .findAny()
// .orElse(new AdminTechnicianScore()); .orElse(new AdminTechnicianScore());
// GetTechnicianPageRequest monthRequest = GetTechnicianPageRequest.builder() GetTechnicianPageRequest monthRequest = GetTechnicianPageRequest.builder()
// .page(1) .page(1)
// .rows(30) .rows(30)
// .sidx("grade") .sidx("grade")
// .sord("asc") .sord("asc")
// //在职 //在职
// .status(1) .status(1)
// .date_utc(Lists.newArrayList(LocalDateTime.of(LocalDate.of(2020, 4, 1), LocalTime.of(0, 0)).toString(), LocalDateTime.now().toString())) .date_utc(Lists.newArrayList(LocalDateTime.of(LocalDate.of(2020, 4, 1), LocalTime.of(0, 0)).toString(), LocalDateTime.now().toString()))
// .technician_id(storeTechnician.getId()) .technician_id(storeTechnician.getId())
// .build(); .build();
//
// HttpEntity<GetTechnicianPageRequest> monthHttpEntity = new HttpEntity<>(monthRequest, headers); HttpEntity<GetTechnicianPageRequest> monthHttpEntity = new HttpEntity<>(monthRequest, headers);
// log.debug(JsonUtilByJackson.writeValueAsString(monthRequest)); log.debug(JsonUtilByJackson.writeValueAsString(monthRequest));
// AdminTechnicianScore monthAdminResult = restTemplate.exchange(gogirlProperties.getAdminBackendUrl(), HttpMethod.POST, monthHttpEntity, responseBodyType) AdminTechnicianScore monthAdminResult = restTemplate.exchange(gogirlProperties.getAdminBackendUrl(), HttpMethod.POST, monthHttpEntity, responseBodyType)
// .getBody() .getBody()
// .getData() .getData()
// .getItems() .getItems()
// .stream() .stream()
// .findAny() .findAny()
// .orElse(new AdminTechnicianScore()); .orElse(new AdminTechnicianScore());
Career career = careerMapper.selectOne(new LambdaQueryWrapper<Career>().eq(Career::getTechnicianId, storeTechnician.getId())); Career career = careerMapper.selectOne(new LambdaQueryWrapper<Career>().eq(Career::getTechnicianId, storeTechnician.getId()));
...@@ -443,66 +460,66 @@ public class Schedule { ...@@ -443,66 +460,66 @@ public class Schedule {
/*当月*/ /*当月*/
//当月开卡数量 //当月开卡数量
// career.setMonthBalanceCardNum(monthAdminResult.getCard_count()); career.setMonthBalanceCardNum(monthAdminResult.getCard_count());
//当月考勤准时 //当月考勤准时
career.setMonthAttendancePercent(null); career.setMonthAttendancePercent(null);
//当月信息录入完整度 //当月信息录入完整度
// career.setMonthInfoPercent(monthAdminResult.getAvg_data_integrity()); career.setMonthInfoPercent(monthAdminResult.getAvg_data_integrity());
//当月订单总数 //当月订单总数
Integer monthOrderNum = careerMapper.queryMonthOrderNum(storeTechnician.getId(), month); Integer monthOrderNum = careerMapper.queryMonthOrderNum(storeTechnician.getId(), month);
career.setMonthOrderNum(monthOrderNum); career.setMonthOrderNum(monthOrderNum);
//当月客户好评率 //当月客户好评率
// career.setMonthPraisePercent(monthAdminResult.getPraise_proportion()); career.setMonthPraisePercent(monthAdminResult.getPraise_proportion());
//当月复购率 //当月复购率
// career.setMonthRepurchasePercent(monthAdminResult.getRepeat_purchase_client_roportion()); career.setMonthRepurchasePercent(monthAdminResult.getRepeat_purchase_client_roportion());
//当月服务客户数 //当月服务客户数
// career.setMonthServeCustomerNum(monthAdminResult.getTotal_client_count()); career.setMonthServeCustomerNum(monthAdminResult.getTotal_client_count());
//当月服务次数 //当月服务次数
// career.setMonthServeNum(monthAdminResult.getTotal_service_count()); career.setMonthServeNum(monthAdminResult.getTotal_service_count());
//当月信息录入完整度 //当月信息录入完整度
// BigDecimal montInfoPercent = monthAdminResult.getAvg_data_integrity(); BigDecimal montInfoPercent = monthAdminResult.getAvg_data_integrity();
// if (montInfoPercent != null) { if (montInfoPercent != null) {
// career.setMonthInfoPercent(montInfoPercent.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); career.setMonthInfoPercent(montInfoPercent.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP));
// } }
/*总计*/ /*总计*/
//总考勤准时率 //总考勤准时率
career.setTotalAttendancePercent(null); career.setTotalAttendancePercent(null);
//总开卡数 //总开卡数
// career.setTotalBalanceCardNum(allAdminResult.getCard_count()); career.setTotalBalanceCardNum(allAdminResult.getCard_count());
//总信息录入完整度 //总信息录入完整度
// BigDecimal totalInfoPercent = allAdminResult.getAvg_data_integrity(); BigDecimal totalInfoPercent = allAdminResult.getAvg_data_integrity();
// if (totalInfoPercent != null) { if (totalInfoPercent != null) {
// career.setTotalInfoPercent(totalInfoPercent.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); career.setTotalInfoPercent(totalInfoPercent.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP));
// } }
//总订单数 //总订单数
Integer totalOrderNum = careerMapper.queryTotalOrderNum(storeTechnician.getId(), month); Integer totalOrderNum = careerMapper.queryTotalOrderNum(storeTechnician.getId(), month);
career.setTotalOrderNum(totalOrderNum); career.setTotalOrderNum(totalOrderNum);
//总好评率 //总好评率
// career.setTotalPraisePercent(allAdminResult.getPraise_proportion()); career.setTotalPraisePercent(allAdminResult.getPraise_proportion());
//总考勤准时比率 //总考勤准时比率
career.setTotalAttendancePercent(null); career.setTotalAttendancePercent(null);
//总复购率 //总复购率
// career.setTotalRepurchasePercent(allAdminResult.getRepeat_purchase_client_roportion()); career.setTotalRepurchasePercent(allAdminResult.getRepeat_purchase_client_roportion());
//服务客户总数 //服务客户总数
// career.setTotalServeCustomerNum(allAdminResult.getTotal_client_count()); career.setTotalServeCustomerNum(allAdminResult.getTotal_client_count());
//服务总次数 //服务总次数
// career.setTotalServeNum(allAdminResult.getTotal_service_count()); career.setTotalServeNum(allAdminResult.getTotal_service_count());
/*美甲师信息*/ /*美甲师信息*/
//美甲师名字 //美甲师名字
......
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