Commit c34f9e97 by huluobin

美甲师评分

parent a02897e3
......@@ -6,13 +6,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.gogirl.domain.order.serve.ScheduleManage;
import com.gogirl.domain.order.serve.ScheduleServe;
import com.gogirl.domain.store.store.StoreTechnician;
import com.gogirl.dto.IdleTimeProgramQuery;
import com.gogirl.dto.LeisureScheduleServe;
import com.gogirl.dto.LeisureScheduleServeQuery;
import com.gogirl.shared.order.serve.command.schedule.CancelScheduleCommand;
import com.gogirl.shared.order.serve.command.schedule.SubmitScheduleCommand;
import com.gogirl.shared.order.serve.command.schedule.UpdateScheduleCommand;
import com.gogirl.shared.order.serve.query.dto.IdleTimeDTO;
import com.gogirl.shared.order.serve.query.qry.IdleTimeQuery;
import com.gogirl.shared.order.serve.query.qry.StoreTechnicianPeriod;
import com.gogirl.shared.order.serve.query.qry.schedule.ScheduleManagePageQuery;
......@@ -31,11 +31,11 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
/**
* 普通预约入口查询预约时间
*
* @param param param
* @param query param
* @return list
* @throws ParseException exception
*/
List<IdleTimeDTO> queryIdleTime(IdleTimeProgramQuery param) throws ParseException, ExecutionException, InterruptedException;
List<IdleTimeDTO> queryIdleTime(IdleTimeQuery query) throws ParseException, ExecutionException, InterruptedException;
/**
* 闲时入口查询预约时间
......@@ -89,7 +89,7 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
*
* @param cmd 提交预约命令
*/
void submitSchedule(SubmitScheduleCommand cmd);
void submitSchedule(SubmitScheduleCommand cmd) throws ParseException, ExecutionException, InterruptedException;
/**
* 更新预约
......@@ -97,7 +97,7 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
* @param cmd
* @return
*/
void updateSchedule(SubmitScheduleCommand cmd);
void updateSchedule(SubmitScheduleCommand cmd) throws ParseException, ExecutionException, InterruptedException;
/**
* 更新预约前检查
......
package com.gogirl.application.store.career.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gogirl.application.store.career.ITechScoreRulesService;
import com.gogirl.domain.store.career.Career;
import com.gogirl.domain.store.career.TechScoreRules;
import com.gogirl.dto.TechScore;
import com.gogirl.dto.admin.AchievementsPersonaResult;
import com.gogirl.dto.admin.AchievementsPersonaResultPageApiRequest;
import com.gogirl.dto.admin.AdminPage;
import com.gogirl.dto.admin.AdminResult;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.mapper.store.career.CareerMapper;
import com.gogirl.infrastructure.mapper.store.career.TechScoreRulesMapper;
import com.gogirl.infrastructure.util.SessionUtils;
import lombok.AllArgsConstructor;
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.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
......@@ -23,24 +34,80 @@ import java.util.List;
* @since 2020-03-12
*/
@Service
@AllArgsConstructor
public class TechScoreRulesServiceImpl extends ServiceImpl<TechScoreRulesMapper, TechScoreRules> implements ITechScoreRulesService {
private final CareerMapper careerMapper;
@Resource
private CareerMapper careerMapper;
@Resource
RestTemplate restTemplate;
@Resource
GogirlProperties gogirlProperties;
@Override
public TechScore getTechScore() {
Integer technicianId = SessionUtils.getTechnicianId();
List<TechScoreRules> techScoreRulesList = this.list();
Career career = careerMapper.selectOne(new LambdaQueryWrapper<Career>()
.eq(Career::getTechnicianId, technicianId));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
Calendar calendar = Calendar.getInstance();
AchievementsPersonaResultPageApiRequest resultPageApiRequest = AchievementsPersonaResultPageApiRequest.builder()
.page(1)
.year(calendar.get(Calendar.YEAR))
.month(calendar.get(Calendar.MONTH))
.status(1)
.page(1)
.rows(30)
.sidx("")
.sord("desc")
.technician_id(SessionUtils.getTechnicianId())
.build();
HttpEntity<AchievementsPersonaResultPageApiRequest> httpEntity = new HttpEntity<>(resultPageApiRequest, httpHeaders);
ParameterizedTypeReference<AdminResult<AdminPage<AchievementsPersonaResult>>> responseBodyType = new ParameterizedTypeReference<AdminResult<AdminPage<AchievementsPersonaResult>>>() {
};
AdminResult<AdminPage<AchievementsPersonaResult>> result =
restTemplate.exchange(gogirlProperties.getAdminBackendAchievementsUrl(), HttpMethod.POST, httpEntity, responseBodyType).getBody();
AchievementsPersonaResult achievementsPersonaResult = result.getData().getItems().stream().findAny().orElseThrow(NullPointerException::new);
TechScore techScore = new TechScore();
techScore.setTechScore(achievementsPersonaResult.getMonth_score().doubleValue());
List<TechScoreRules> techScoreRulesList = new ArrayList<>();
String card = String.format("开卡得分:%s。开卡率:%s。权重:%s。规则:20%%该项满分、5%%该项0分。可以超过100分",
achievementsPersonaResult.getActivate_a_card_score().toString(),
achievementsPersonaResult.getActivate_a_card_val().toString()
, achievementsPersonaResult.getActivate_a_card_proportion_str());
TechScoreRules t1 = TechScoreRules.builder().sort(1).techScoreRules(card).build();
techScoreRulesList.add(t1);
//好评得分
String comment = String.format("好评率得分:%s。好评率:%s。权重:%s。规则:分数=好评(>3星)数/总评论数*100,评论包括所有渠道投诉。"
, achievementsPersonaResult.getPraise_score().toString()
, achievementsPersonaResult.getPraise_val().toString()
, achievementsPersonaResult.getPraise_proportion_str());
TechScoreRules t2 = TechScoreRules.builder().sort(2).techScoreRules(comment).build();
techScoreRulesList.add(t2);
//服务准时得分
String serviceTime = String.format("服务准时得分: %s。服务准时得分率:%s。权重: %s。规则:+10%%,-20%%以内为准。90%%出勤率为满分"
, achievementsPersonaResult.getService_time_score().toString()
, achievementsPersonaResult.getService_time_val().toString()
, achievementsPersonaResult.getService_time_proportion_str());
TechScoreRules t3 = TechScoreRules.builder().sort(3).techScoreRules(serviceTime).build();
techScoreRulesList.add(t3);
//店务得分
String shop = String.format("店务得分:%s。权重:%s。规则:该项得分为满分,抽查发现问题时一个问题扣1分"
, achievementsPersonaResult.getShop_item_score().toString()
, achievementsPersonaResult.getShop_item_proportion_str());
TechScoreRules t4 = TechScoreRules.builder().sort(4).techScoreRules(shop).build();
techScoreRulesList.add(t4);
//总分
String total = String.format("总分:%s。规则:按月计算,达到满分以上奖励300元,低于80分罚500元", achievementsPersonaResult.getMonth_score().toString());
TechScoreRules t5 = TechScoreRules.builder().sort(5).techScoreRules(total).build();
techScoreRulesList.add(t5);
techScore.setTechScoreRulesList(techScoreRulesList);
if (career != null) {
techScore.setTechScore(career.getTechScore());
} else {
techScore.setTechScore(0);
}
return techScore;
}
}
......@@ -12,7 +12,6 @@ import com.gogirl.application.xcx.WechatService;
import com.gogirl.domain.order.serve.OrderManage;
import com.gogirl.domain.order.serve.OrderRecord;
import com.gogirl.domain.order.serve.OrderServe;
import com.gogirl.domain.order.serve.ScheduleManage;
import com.gogirl.domain.product.serve.BaseServe;
import com.gogirl.domain.store.store.StoreManage;
import com.gogirl.domain.user.customer.Customer;
......@@ -22,7 +21,6 @@ import com.gogirl.domain.xcx.GogirlConfig;
import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.dto.customer.CustomerOrderDetail;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.common.util.StringUtils;
import com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderRecordMapper;
......@@ -206,11 +204,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
}
@Override
public Customer authorized1(String token, String encryptedData, String iv) throws InvalidAlgorithmParameterException {
public Customer authorized1(String token, String encryptedData, String iv) {
GogirlToken gogirlToken = gogirlTokenService.getByToken(token);
JSONObject data = WxUtils.decrypt(encryptedData, gogirlToken.getSessionKey(), iv);
/*1、解密微信用户数据*/
String unionid = (String) data.get("unionId");
String openid = (String) data.get("openId");
Integer gender = (Integer) data.get("gender");
......@@ -220,8 +219,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
String province = (String) data.get("province");
String nickName = filterEmoji((String) data.get("nickName"));
/*2、根据openid查询用户*/
Customer customer = customerMapper.selectOne(new LambdaQueryWrapper<Customer>().eq(Customer::getOpenid1, openid));
/*3、更新用户*/
customer.setSex(gender == 1 ? "男" : gender == 2 ? "女" : "未知");
customer.setHeadimgurl(avatarUrl);
customer.setNickname(nickName);
......@@ -237,21 +238,25 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
public Customer authorizedPhone(String token, String encryptedData, String iv) throws InvalidAlgorithmParameterException {
GogirlToken gogirlToken = gogirlTokenService.getByToken(token);
/*1、获取微信用户手机号数据*/
JSONObject data = WxUtils.decrypt(encryptedData, gogirlToken.getSessionKey(), iv);
String phone = (String) data.get("purePhoneNumber");
/*2、更新用户token*/
gogirlToken.setPhone(phone);
gogirlTokenService.updateByToken(gogirlToken);
Customer customer = customerMapper.selectById(gogirlToken.getCustomerId());
Customer phoneCustomer = customerMapper.selectOne(new LambdaQueryWrapper<Customer>().eq(Customer::getPhone, phone));
//如果存在手机号
if (StringUtils.isNotEmpty(customer.getPhone())) {
throw new RRException("您已经授权过手机号");
}
//当前用户没有绑定手机号 ,并且授权的手机号已经存在对应的用户
if (phoneCustomer != null) {
/*3、将当前用户的信息绑定到授权手机号对应的用户上*/
phoneCustomer.setSex(customer.getSex());
phoneCustomer.setHeadimgurl(customer.getHeadimgurl());
phoneCustomer.setNickname(customer.getNickname());
......@@ -268,23 +273,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
phoneCustomer.setState(customer.getState());
phoneCustomer.setUpdateTime(new Date());
/*3、删除当前用户*/
customerMapper.deleteById(customer);
/*4、更新授权手机号对应的用户*/
customerMapper.updateById(phoneCustomer);
List<ScheduleManage> scheduleManageList = scheduleManageMapper.selectList(new LambdaQueryWrapper<ScheduleManage>()
.eq(ScheduleManage::getTelephone, phone));
if (ListUtil.isNotEmpty(scheduleManageList)) {
scheduleManageList.forEach(scheduleManage -> {
scheduleManage.setTelephone(phone);
scheduleManageMapper.updateById(scheduleManage);
});
}
//清除token
/*5、清空当前用户登录token*/
gogirlTokenService.remove(token);
return phoneCustomer;
}
//不存在手机号
//当前用户没有绑定手机号 ,授权手机号没有对应用户存在
else {
/*6、更新当前用户*/
customer.setPhone(phone);
customerMapper.updateById(customer);
return customer;
......
......@@ -3,6 +3,7 @@ package com.gogirl.domain.store.career;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -18,6 +19,7 @@ import java.io.Serializable;
* @since 2020-03-12
*/
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "TechScoreRules对象", description = "")
......
package com.gogirl.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gogirl.domain.order.serve.ScheduleServe;
import com.gogirl.domain.user.customer.Customer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class IdleTimeProgramQuery {
private Integer id;
//修改预约的时候,修改前的id
@ApiModelProperty("修改预约的时候,修改前的id")
private Integer oldId;
@ApiModelProperty("预约订单号")
private String scheduledNo;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("预约时间")
private Date scheduledTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("最近修改时间")
private Date lastUpdateTime;
@ApiModelProperty("下单人id")
private Integer scheduledUser;
@ApiModelProperty("店铺端预约用户名")
private String storeScheduleUsername;
@ApiModelProperty("店铺端预约手机号码")
private String telephone;
@ApiModelProperty("预约到达时间字符串")
private String arriveTimeString;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("预约到达时间")
private Date arriveTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("上次服务时间")
private Date lastServiceTime;
@ApiModelProperty("到店人")
private String arriveUser;
@ApiModelProperty("下单店铺id")
private Integer departmentId;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除备注")
private String delRemaerk;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("开单时间")
private Date openbillTime;
@ApiModelProperty("已预约#1 失约#2 守约#3 已取消#4 已删除#5")
private Integer status;
@ApiModelProperty("创建人")
private String createUser;
@ApiModelProperty("店铺名称")
private String departmentName;
@ApiModelProperty("删除服务字段")
private String deleteServe;
@ApiModelProperty("id")
private Integer scheduledType;
@ApiModelProperty("提醒类型")
private Integer remindStatus;
@ApiModelProperty("已读状态")
private Integer isRead;
@ApiModelProperty("统计开始时间")
private String startTime;
@ApiModelProperty("统计结束时间")
private String endTime;
@ApiModelProperty("分页查询当天预约")
private String sameDayTime;
@ApiModelProperty("发送服务通知需要的formId")
private String formId;
/**
* 非数据库字段
*/
@TableField(exist = false)
@ApiModelProperty("token")
private String token;
@TableField(exist = false)
@ApiModelProperty("预约时间")
private String scheduleDate;
@TableField(exist = false)
@ApiModelProperty("预约下服务列表")
private List<ScheduleServe> listScheduleServer;
@TableField(exist = false)
@ApiModelProperty("预约用户信息")
private Customer customer;
@TableField(exist = false)
private List<Long> dateTimeList;
@TableField(exist = false)
private Boolean showNodeDetail;
}
//package com.gogirl.dto;
//
//import com.baomidou.mybatisplus.annotation.TableField;
//import com.gogirl.domain.order.serve.ScheduleServe;
//import com.gogirl.domain.user.customer.Customer;
//import com.gogirl.shared.order.serve.query.qry.ScheduleServeQuery;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.Data;
//
//import java.util.List;
//
//@Data
//public class IdleTimeQry {
//
// private Integer id;
//
// @ApiModelProperty("下单店铺id")
// private Integer departmentId;
//
// @TableField(exist = false)
// @ApiModelProperty("预约时间")
// private String scheduleDate;
//
// @TableField(exist = false)
// @ApiModelProperty("预约下服务列表")
// private List<ScheduleServeQuery> listScheduleServer;
//
// @TableField(exist = false)
// private List<Long> dateTimeList;
//
// @TableField(exist = false)
// private Boolean showNodeDetail;
//}
......@@ -10,5 +10,5 @@ public class TechScore {
private List<TechScoreRules> techScoreRulesList;
private Integer techScore;
private Double techScore;
}
package com.gogirl.dto.admin;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class AchievementsPersonaResult {
private String shop_item_proportion_str;//20.00 %;
private String marketing_proportion_str;//0.00 %;
private String activate_a_card_proportion_str;//40.00 %;
private String repeat_purchase_45_proportion_str;//0.00 %;
private String complaint_proportion_str;//0.00 %;
private String study_personal_proportion_str;//0.00 %;
private String external_training_proportion_str;//0.00 %;
private String old_belt_new_proportion_str;//0.00 %;
private String time_weight_month_proportion_str;//50.00 %;
private String time_weight_quarter_proportion_str;//40.00 %;
private String time_weight_year_proportion_str;//10.00 %;
private String information_complete_proportion_str;//0.00 %;
private String service_time_proportion_str;//20.00 %;
private String praise_proportion_str;//20.00 %;
private Integer id;//334;
private Integer year;//2020;
private Integer month;//4;
private String time;//2020-04-01T00;//00;//00;
private Integer technician_id;//99;
private Integer store_id;//17;
private String technician_name;//姜晴文;
private BigDecimal marketing_score;//0.0000;
private BigDecimal marketing_val;//0.0000;
private BigDecimal marketing_proportion;//0.0000;
private BigDecimal activate_a_card_score;//26.6667;
private BigDecimal activate_a_card_val;//0.0900;
private BigDecimal activate_a_card_proportion;//0.4000;
private BigDecimal repeat_purchase_45_score;//0.0000;
private BigDecimal repeat_purchase_45_val;//0.0000;
private BigDecimal repeat_purchase_45_proportion;//0.0000;
private BigDecimal complaint_score;//0.0000;
private BigDecimal complaint_val;//0.0000;
private BigDecimal complaint_proportion;//0.0000;
private BigDecimal study_personal_score;//0.0000;
private BigDecimal study_personal_val;//0.0000;
private BigDecimal study_personal_proportion;//0.0000;
private BigDecimal external_training_score;//0.0000;
private BigDecimal external_training_val;//0.0000;
private BigDecimal external_training_proportion;//0.0000;
private BigDecimal old_belt_new_score;//0.0000;
private BigDecimal old_belt_new_val;//0.0000;
private BigDecimal old_belt_new_proportion;//0.0000;
private BigDecimal month_score;//52.5087;
private BigDecimal time_weight_month_proportion;//0.5000;
private BigDecimal quarter_score;//52.5087;
private BigDecimal time_weight_quarter_proportion;//0.4000;
private BigDecimal year_score;//65.6661;
private BigDecimal time_weight_year_proportion;//0.1000;
private BigDecimal final_score;//53.8244;
private BigDecimal information_complete_val;//0.0000;
private BigDecimal information_complete_score;//0.0000;
private BigDecimal information_complete_proportion;//0.0;
private BigDecimal service_time_val;//0.2250;
private BigDecimal service_time_score;//25.0000;
private BigDecimal service_time_proportion;//0.2000;
private BigDecimal praise_val;//0.8421;
private BigDecimal praise_score;//84.2100;
private BigDecimal praise_proportion;//0.2000;
private BigDecimal shop_item_val;//0.0000;
private BigDecimal shop_item_score;//100.0000;
private BigDecimal shop_item_proportion;//0.2000
}
package com.gogirl.dto.admin;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class AchievementsPersonaResultPageApiRequest {
private Integer year;
private Integer month;
private Integer status;
private Integer page;
private Integer rows;
private String sidx;
private String sord;
private Integer technician_id;
}
......@@ -60,4 +60,6 @@ public class GogirlProperties {
* 后台地址
*/
private String adminBackendUrl;
private String adminBackendAchievementsUrl;
}
package com.gogirl.infrastructure.util;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
......@@ -56,4 +59,46 @@ public class PrefixUtils {
}
static <T> void permutation(List<T> source, int i, List<List<T>> list) {
// 如果为空
if (ListUtil.isEmpty(source))
return;
// 如果i指向了最后一个字符
if (i == source.size() - 1) {
if (list.contains(source))
return;
list.add(source);
} else {
// i指向当前我们做排列操作的字符串的第一个字符
for (int j = i; j < source.size(); j++) {
// 把做排列操作的字符串的第一个字符和后面的所有字符交换
T temp = source.get(j);
source.set(j, source.get(i));
source.set(i, temp);
// obj[j] = obj[i];
// obj[i] = temp;
// 交换后对i后面的字符串递归做排列操作
permutation(source, i + 1, list);
// 每一轮结束后换回来进行下一轮排列操作
// temp = obj[j];
temp = source.get(j);
// obj[j] = obj[i];
// obj[i] = temp;
source.set(j, source.get(i));
source.set(i, temp);
}
}
}
public static void main(String[] args) {
List<List<String>> lists = new ArrayList<>();
List<String> source = Lists.newArrayList("a1", "b2", "c3");
PrefixUtils.permutation(source, 0, lists);
for (int i = 0; i < lists.size(); i++) {
System.out.println(lists.get(i) + " ");
}
}
}
......@@ -14,7 +14,6 @@ import com.gogirl.domain.order.serve.ScheduleManage;
import com.gogirl.domain.product.serve.BaseProduce;
import com.gogirl.domain.store.store.StoreTechnician;
import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.dto.IdleTimeProgramQuery;
import com.gogirl.dto.LeisureScheduleServe;
import com.gogirl.dto.LeisureScheduleServeQuery;
import com.gogirl.dto.QueryLeisureTechnicianReq;
......@@ -24,6 +23,7 @@ import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.mapper.product.purchase.PurchaseSkuMapper;
import com.gogirl.infrastructure.mapper.product.serve.BaseProduceMapper;
import com.gogirl.infrastructure.util.SessionUtils;
import com.gogirl.infrastructure.util.lock.CustomerIdLock;
import com.gogirl.infrastructure.util.lock.ScheduleServeIdLock;
import com.gogirl.infrastructure.util.lock.ScheduledLock;
import com.gogirl.shared.order.serve.command.schedule.CancelScheduleCommand;
......@@ -31,6 +31,7 @@ import com.gogirl.shared.order.serve.command.schedule.SubmitScheduleCommand;
import com.gogirl.shared.order.serve.command.schedule.UpdateScheduleCommand;
import com.gogirl.shared.order.serve.query.dto.IdleTimeDTO;
import com.gogirl.shared.order.serve.query.dto.ScheduleManageDTO;
import com.gogirl.shared.order.serve.query.qry.IdleTimeQuery;
import com.gogirl.shared.order.serve.query.qry.schedule.ScheduleManagePageQuery;
import com.gogirl.shared.product.query.dto.PurchaseSkuDTO;
import com.gogirl.shared.user.query.qry.VipServeQuery;
......@@ -64,7 +65,7 @@ public class ScheduleManageController {
@ApiModelProperty("查询可预约时间列表")
@PostMapping("/customer/schedule/queryIdleTime")
public JsonResult<List<IdleTimeDTO>> queryIdleTime(@RequestBody IdleTimeProgramQuery qry) throws ParseException, ExecutionException, InterruptedException {
public JsonResult<List<IdleTimeDTO>> queryIdleTime(@RequestBody IdleTimeQuery qry) throws ParseException, ExecutionException, InterruptedException {
List<IdleTimeDTO> idleTimeDTOList = scheduleManageService.queryIdleTime(qry);
return JsonResult.success(idleTimeDTOList);
}
......@@ -82,9 +83,16 @@ public class ScheduleManageController {
@ApiOperation("提交预约")
@PostMapping("/customer/schedule/submitSchedule")
public JsonResult<Void> submitSchedule(@RequestHeader String token,
@RequestBody SubmitScheduleCommand cmd) {
cmd.getScheduleManageDTO().setScheduledUser(SessionUtils.getCustomerId());
scheduleManageService.submitSchedule(cmd);
@RequestBody SubmitScheduleCommand cmd) throws ParseException, ExecutionException, InterruptedException {
Integer customerId = SessionUtils.getCustomerId();
CustomerIdLock lock = CustomerIdLock.getInsatance();
try {
lock.lock(customerId);
cmd.getScheduleManageDTO().setScheduledUser(customerId);
scheduleManageService.submitSchedule(cmd);
} finally {
lock.unlock(customerId);
}
return JsonResult.success();
}
......@@ -105,10 +113,8 @@ public class ScheduleManageController {
@ApiOperation("用户更新预约")
@PostMapping("/customer/schedule/updateSchedule")
public JsonResult<Void> updateSchedule(@RequestHeader String token,
@RequestBody SubmitScheduleCommand cmd) {
Integer currentCustomerId = Optional.ofNullable(gogirlTokenService.getByToken(token).getCustomerId())
.orElseThrow(() -> new RRException(500, "token不存在"));
@RequestBody SubmitScheduleCommand cmd) throws ParseException, ExecutionException, InterruptedException {
Integer currentCustomerId = SessionUtils.getCustomerId();
cmd.getScheduleManageDTO().setScheduledUser(currentCustomerId);
ScheduledLock scheduledLock = ScheduledLock.getInsatance();
......@@ -211,7 +217,7 @@ public class ScheduleManageController {
@ApiOperation("更新预约")
@PostMapping("/technician/schedule/updateSchedule")
public JsonResult<Void> updateSchedule(@RequestBody SubmitScheduleCommand cmd) {
public JsonResult<Void> updateSchedule(@RequestBody SubmitScheduleCommand cmd) throws ParseException, ExecutionException, InterruptedException {
cmd.getScheduleManageDTO().setDepartmentId(SessionUtils.getTechnicianToken().getDepartmentId());
scheduleManageService.updateSchedule(cmd);
return JsonResult.success();
......
......@@ -5,13 +5,11 @@ import com.gogirl.domain.user.customer.Customer;
import com.gogirl.dto.customer.CustomerOrderDetail;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.service.file.FileService;
import com.gogirl.infrastructure.util.Base64Utils;
import com.gogirl.shared.user.query.qry.CustomerQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.security.InvalidAlgorithmParameterException;
......@@ -50,19 +48,7 @@ public class CustomerController {
return JsonResult.success();
}
/*cmd接口结束*/
/*query接口开始*/
/*query接口结束*/
@ApiOperation(("查询会员"))
@PostMapping("/customer/xcx/query")
public JsonResult<Customer> query(@RequestBody CustomerQuery qry) {
Customer customer = customerService.getById(qry.getCustomerId());
return JsonResult.success(customer);
}
@ApiOperation(value = "客户根据code获取token")
@ApiOperation(value = "小程序用户登录")
@GetMapping("/customer/xcx/login")
public JsonResult<String> login(@RequestParam String code) {
String token = customerService.login(code);
......@@ -81,6 +67,32 @@ public class CustomerController {
return JsonResult.success(customer);
}
@ApiOperation(value = "h5用户登录")
@GetMapping("/customer/no_h5Login")
public JsonResult<String> h5Login(@RequestParam Integer orderId) {
String token = customerService.h5Login(orderId);
return JsonResult.success(token);
}
@ApiOperation(value = "超时测试接口")
@RequestMapping("/customer/testTimeOut")
public JsonResult<Void> testTimeOut() throws InterruptedException {
Thread.sleep(36000L);
return JsonResult.success();
}
/*cmd接口结束*/
/*query接口开始*/
@ApiOperation("查询会员")
@PostMapping("/customer/xcx/query")
public JsonResult<Customer> query(@RequestBody CustomerQuery qry) {
Customer customer = customerService.getById(qry.getCustomerId());
return JsonResult.success(customer);
}
@ApiOperation(value = "客户授权手机号码")
@RequestMapping(method = {RequestMethod.POST}, value = "/customer/xcx/authorizedPhone")
public JsonResult<Customer> authorizedPhone(@RequestHeader String token,
......@@ -91,31 +103,14 @@ public class CustomerController {
return JsonResult.success(customer);
}
@GetMapping("/customer/xcx/getUserInfo")
@ApiOperation(value = "客户根据token获取用户信息")
@GetMapping("/customer/xcx/getUserInfo")
public JsonResult<Customer> getUserInfo(@RequestParam String token) throws Exception {
log.info("根据token:" + token + ",查询用户信息.");
Customer customer = customerService.getUserInfo(token);
return JsonResult.success(customer);
}
@ApiOperation(value = "图片上传")
@PostMapping("/customer/xcx/upload")
public JsonResult<String> upload(MultipartFile multipartFile) throws Exception {
log.info("图片上传");
String imgUrl = fileService.saveImage(multipartFile);
return JsonResult.success(imgUrl);
}
@ApiOperation(value = "base64图片上传")
@PostMapping("/customer/xcx/no_base64Upload")
public JsonResult<String> base64Upload(@RequestBody String base64) throws Exception {
log.info("图片上传");
MultipartFile multipartFile = Base64Utils.base64ToMultipart(base64);
String imgUrl = fileService.saveImage(multipartFile);
return JsonResult.success(imgUrl);
}
@ApiOperation(value = "查询用户可选年龄段")
@PostMapping("/technician/getAgeGroups")
public JsonResult<List<String>> getAgeGroups() {
......@@ -125,10 +120,8 @@ public class CustomerController {
@ApiOperation(value = "用户详情数据查看")
@PostMapping("/technician/queryCustomerDetail")
public JsonResult<CustomerOrderDetail> queryCustomerDetail(@RequestHeader String token,
@RequestParam Integer customerId,
public JsonResult<CustomerOrderDetail> queryCustomerDetail(@RequestParam Integer customerId,
@RequestParam(required = false) Integer orderId) {
CustomerOrderDetail customerOrderDetail = customerService.queryCustomerDetail(customerId, orderId);
return JsonResult.success(customerOrderDetail);
}
......@@ -152,18 +145,6 @@ public class CustomerController {
customerService.updateCustomerDetail(birthdayMonth, birthdayDay, ageGroup, customerId, orderId, orderServeId, storeRecordRealName, sex, age, job, preference, character, customerSource);
return JsonResult.success();
}
/*query接口结束*/
@ApiOperation(value = "h5用户登录")
@GetMapping("/customer/no_h5Login")
public JsonResult<String> h5Login(@RequestParam Integer orderId) {
String token = customerService.h5Login(orderId);
return JsonResult.success(token);
}
@ApiOperation(value = "超时测试接口")
@RequestMapping("/customer/testTimeOut")
public JsonResult<Void> testTimeOut() throws InterruptedException {
Thread.sleep(36000L);
return JsonResult.success();
}
}
package com.gogirl.interfaces.user;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.service.file.FileService;
import com.gogirl.infrastructure.util.Base64Utils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@RestController
@Api(tags = "文件服务接口")
@Slf4j
public class FileController {
@Resource
FileService fileService;
@ApiOperation(value = "图片上传")
@PostMapping("/customer/xcx/upload")
public JsonResult<String> upload(MultipartFile multipartFile) throws Exception {
log.info("图片上传");
String imgUrl = fileService.saveImage(multipartFile);
return JsonResult.success(imgUrl);
}
@ApiOperation(value = "base64图片上传")
@PostMapping("/customer/xcx/no_base64Upload")
public JsonResult<String> base64Upload(@RequestBody String base64) throws Exception {
log.info("图片上传");
MultipartFile multipartFile = Base64Utils.base64ToMultipart(base64);
String imgUrl = fileService.saveImage(multipartFile);
return JsonResult.success(imgUrl);
}
}
......@@ -8,7 +8,7 @@ import com.gogirl.domain.user.customer.CustomerMessage;
import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.domain.xcx.VisitsLog;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.util.SessionUtils;
import com.gogirl.shared.user.command.ReadMessageCommand;
import com.gogirl.shared.user.query.qry.CustomerMessagePageQuery;
import io.swagger.annotations.Api;
......@@ -23,19 +23,13 @@ import org.springframework.web.bind.annotation.*;
@Api(tags = {"用户消息消息接口"})
@Slf4j
public class MessageController {
private final GogirlTokenService gogirlTokenService;
private final VisitLogService visitLogService;
private final CustomerMessageService customerMessageService;
@ApiModelProperty("我的消息")
@PostMapping("/customer/message/queryPageMessage")
public JsonResult<Page<CustomerMessage>> queryPageMessage(@RequestHeader String token,
@RequestBody CustomerMessagePageQuery qry) {
Page<CustomerMessage> customerMessagePage = customerMessageService.queryPageMessage(qry);
return JsonResult.success(customerMessagePage);
}
/*cmd接口开始*/
@ApiModelProperty("已读消息")
@PostMapping("/customer/message/customer/readMessage")
public JsonResult<Void> readMessage(@RequestBody ReadMessageCommand cmd) {
......@@ -82,11 +76,7 @@ public class MessageController {
@RequestParam(required = false) String pageName,
@RequestParam(required = false) Integer produceId) {
GogirlToken gt = gogirlTokenService.getByToken(token);
if (gt == null) {
throw new RRException(2000, "token失效");
}
Integer customerId = gt.getCustomerId();
Integer customerId = SessionUtils.getCustomerId();
VisitsLog visitsLog = visitLogService.pageIn(customerId, type, activityId, shareType, shareUserId, serviceId, departmentId, pageName, produceId);
return JsonResult.success(visitsLog.getId());
}
......@@ -100,5 +90,16 @@ public class MessageController {
return JsonResult.success();
}
/*cmd接口结束*/
/*query接口开始*/
@ApiModelProperty("我的消息")
@PostMapping("/customer/message/queryPageMessage")
public JsonResult<Page<CustomerMessage>> queryPageMessage(@RequestHeader String token,
@RequestBody CustomerMessagePageQuery qry) {
Page<CustomerMessage> customerMessagePage = customerMessageService.queryPageMessage(qry);
return JsonResult.success(customerMessagePage);
}
/*query接口结束*/
}
......@@ -8,18 +8,19 @@ import java.util.List;
@Data
public class IdleTimeQuery {
@ApiModelProperty("所有美甲师")
List<StoreTechnicianPeriod> storeTechnicianDTOList;
@ApiModelProperty("时间节点")
List<Long> dateTimeList;
private Integer id;
private Integer DepartmentId;
@ApiModelProperty("预约时间")
private String scheduleDate;
@ApiModelProperty("预约")
private List<ScheduleServeQuery> scheduleServeQueryList;
private List<ScheduleServeQuery> listScheduleServer;
private Boolean showNodeDetail;
}
......@@ -3,6 +3,7 @@ package com.gogirl.shared.order.serve.query.qry;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 时间段类
......@@ -20,6 +21,12 @@ public class Period implements Serializable {
this.length = endTime - startTime;
}
public Period(Date startTime, Date endTime) {
this.startTime = startTime.getTime();
this.endTime = endTime.getTime();
this.length = this.endTime - this.startTime;
}
public Period() {
}
......
......@@ -92,6 +92,7 @@ gogirl:
test-paper-time: 1440
#后台后端接口访问地址
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url: http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx:
pay:
......
......@@ -93,6 +93,7 @@ gogirl:
test-paper-time: 1
#后台后端接口访问地址
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url: http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx:
pay:
......
......@@ -91,6 +91,7 @@ gogirl:
test-paper-time: 1440
#后台后端接口访问地址
admin-backend-url: http://admin.begogirls.com:7712/api/ReportTable/GetTechnicianPageApi
admin-backend-achievements-url: http://admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx:
pay:
......
......@@ -92,6 +92,7 @@ gogirl:
test-paper-time: 1440
#后台后端接口访问地址
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url: http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
wx:
pay:
......
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