Commit 97caf669 by huluobin

update

parent 034545f5
...@@ -3,6 +3,7 @@ package com.gogirl.domain.store.training; ...@@ -3,6 +3,7 @@ package com.gogirl.domain.store.training;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
...@@ -12,23 +13,34 @@ public class TrainingCourse { ...@@ -12,23 +13,34 @@ public class TrainingCourse {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer id; private Integer id;
@ApiModelProperty("课程分类")
private Integer typeId; private Integer typeId;
@ApiModelProperty("课程名称")
private String name; private String name;
@ApiModelProperty("课程sku")
private String no; private String no;
private String modality; @ApiModelProperty("能力对象")
private String object; private String object;
@ApiModelProperty("展示内容")
private String content; private String content;
@ApiModelProperty("课程简述")
private String describe;
@ApiModelProperty("教材文件路径")
private String teachingMaterialPath; private String teachingMaterialPath;
private String assessmentMethods; @ApiModelProperty("实操性")
private String practicality;
private Integer duration; @ApiModelProperty("课程时长,分钟")
private String duration;
@ApiModelProperty("课程优势")
private String advantage;
} }
...@@ -23,11 +23,6 @@ import com.gogirl.domain.store.store.StoreTechnician; ...@@ -23,11 +23,6 @@ import com.gogirl.domain.store.store.StoreTechnician;
import com.gogirl.domain.user.customer.Customer; 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.dto.admin.AdminPage;
import com.gogirl.dto.admin.AdminResult;
import com.gogirl.dto.admin.AdminTechnicianScore;
import com.gogirl.dto.admin.GetTechnicianPageRequest;
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;
...@@ -48,24 +43,15 @@ import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMappe ...@@ -48,24 +43,15 @@ 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.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 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;
...@@ -371,50 +357,50 @@ public class Schedule { ...@@ -371,50 +357,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()));
...@@ -438,66 +424,66 @@ public class Schedule { ...@@ -438,66 +424,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());
/*美甲师信息*/ /*美甲师信息*/
//美甲师名字 //美甲师名字
......
spring: spring:
profiles: profiles:
active: dev active: prod
servlet: servlet:
#文件上传最大容量 #文件上传最大容量
multipart: multipart:
......
...@@ -44,6 +44,7 @@ import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMappe ...@@ -44,6 +44,7 @@ import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMappe
import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper; import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper;
import com.gogirl.infrastructure.mapper.xcx.TimeNodeMapper; import com.gogirl.infrastructure.mapper.xcx.TimeNodeMapper;
import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper; import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper;
import com.gogirl.infrastructure.schedule.Schedule;
import com.gogirl.infrastructure.service.mail.MailService; import com.gogirl.infrastructure.service.mail.MailService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
...@@ -481,4 +482,13 @@ public class Test { ...@@ -481,4 +482,13 @@ public class Test {
public void testMail() { public void testMail() {
mailService.sendSimpleMail("robbendev@qq.com","pre","test"); mailService.sendSimpleMail("robbendev@qq.com","pre","test");
} }
@Resource
Schedule schedule;
@org.junit.Test
public void career(){
schedule.syncTechnicianCareer();
}
} }
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