修复员工颜色设置
This commit is contained in:
+5
@@ -49,6 +49,11 @@ public class NailArtistInfoDTO {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 预约展示颜色
|
||||
*/
|
||||
private String color;
|
||||
|
||||
/**
|
||||
* Field `participateProduction` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
||||
*/
|
||||
|
||||
+5
@@ -47,6 +47,11 @@ public class NailArtistInfoDO extends BaseEntity {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 预约展示颜色
|
||||
*/
|
||||
private String color;
|
||||
|
||||
@TableField("participate_production")
|
||||
/**
|
||||
* Field `participateProduction` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
||||
|
||||
+8
-1
@@ -314,7 +314,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
vo.setShortName(PlanningCalendarSupport.shortName(vo.getName()));
|
||||
vo.setPhone(firstNonBlank(user.getContactPhone(), user.getPhone(), ""));
|
||||
vo.setAvatar(user.getAvatar());
|
||||
vo.setColor(colorForArtist(user.getId(), i));
|
||||
vo.setColor(resolveArtistColor(info, user.getId(), i));
|
||||
vo.setStatus(info == null || info.getStatus() == null ? user.getStatus() : info.getStatus());
|
||||
vo.setStatusText(Integer.valueOf(0).equals(vo.getStatus()) ? "休息" : "可预约");
|
||||
vo.setWorkStartTime(info == null || info.getWorkStartTime() == null ? null : info.getWorkStartTime().toString());
|
||||
@@ -846,6 +846,13 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
.collect(Collectors.toMap(UserDO::getId, Function.identity(), (a, b) -> a));
|
||||
}
|
||||
|
||||
private String resolveArtistColor(NailArtistInfoDO info, Long artistId, int index) {
|
||||
if (info != null && hasText(info.getColor()) && info.getColor().trim().matches("^#[0-9a-fA-F]{6}$")) {
|
||||
return info.getColor().trim().toUpperCase();
|
||||
}
|
||||
return colorForArtist(artistId, index);
|
||||
}
|
||||
|
||||
private String colorForArtist(Long artistId, int index) {
|
||||
if (artistId == null) {
|
||||
return ARTIST_COLORS.get(index % ARTIST_COLORS.size());
|
||||
|
||||
Reference in New Issue
Block a user