技师是否可预约订单时间设置
This commit is contained in:
parent
98f32e5b04
commit
018686ee11
|
@ -37,7 +37,29 @@ public class AppArtificerTimeController {
|
|||
return artificerTimeService.selectArtificerTimeListByArtificerId(artificerId,artificerDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idleTime 可接单时间
|
||||
* @param busyTime 不可接单时间
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/setArtificerTime")
|
||||
@ApiOperation("设置时间管理")
|
||||
@Login
|
||||
public Result setArtificerTime(String idleTime,String busyTime,@RequestAttribute("userId") Long userId){
|
||||
return artificerTimeService.setArtificerTime( idleTime, busyTime, userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param flag 1接单 2不接单
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/setArtificerAccept")
|
||||
@ApiOperation("设置是否接单")
|
||||
@Login
|
||||
public Result setArtificerAccept(Integer flag,@RequestAttribute("userId") Long userId){
|
||||
return artificerTimeService.setArtificerAccept( flag, userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -251,6 +251,11 @@ public class Artificer implements Serializable {
|
|||
*/
|
||||
private String grade;
|
||||
|
||||
/**
|
||||
* 是否可接单 1可 2不可
|
||||
*/
|
||||
private Integer acceptOrders;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ArtificerClassify> artificerClassifyList;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.artificer.entity.Artificer;
|
||||
import com.sqx.modules.artificer.entity.ArtificerTime;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
|
||||
public interface ArtificerTimeService extends IService<ArtificerTime> {
|
||||
|
||||
|
@ -14,4 +15,8 @@ public interface ArtificerTimeService extends IService<ArtificerTime> {
|
|||
|
||||
Result selectArtificerTimeListByArtificerId(Long artificerId,String artificerDate);
|
||||
|
||||
Result setArtificerTime(String idleTime,String busyTime,Long userId);
|
||||
|
||||
Result setArtificerAccept(Integer flag,Long userId);
|
||||
|
||||
}
|
|
@ -97,6 +97,152 @@ public class ArtificerTimeServiceImpl extends ServiceImpl<ArtificerTimeDao, Arti
|
|||
return Result.success().put("data",list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result setArtificerTime(String idleTime,String busyTime,Long userId){
|
||||
Artificer artificer = artificerService.selectArtificerByUserId(userId);
|
||||
if(StringUtils.isNotEmpty(idleTime)){
|
||||
Map<String,List> dateMap = new HashMap();
|
||||
for(String times:idleTime.split(",")){
|
||||
String[] datetime = times.split(" ");
|
||||
if(datetime!=null && datetime.length>0) {
|
||||
baseMapper.delete(new QueryWrapper<ArtificerTime>().eq("artificer_date", datetime[0]).eq("artificer_id", artificer.getArtificerId()).eq("artificer_time", datetime[1]));
|
||||
if(dateMap.get(datetime[0])!=null){
|
||||
List<String> timeList = dateMap.get(datetime[0]);
|
||||
timeList.add(datetime[1]);
|
||||
}else{
|
||||
List<String> timeList = new ArrayList<>();
|
||||
timeList.add(datetime[1]);
|
||||
dateMap.put(datetime[0],timeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String,Map> busyMap = getBusyMap(dateMap);
|
||||
for (String key : busyMap.keySet()) {
|
||||
Map<String,String> busyTimeMap = busyMap.get(key);
|
||||
for (String timeKey : busyTimeMap.keySet()) {
|
||||
ArtificerTime artificerTime=new ArtificerTime();
|
||||
artificerTime.setArtificerDate(key);
|
||||
artificerTime.setArtificerTime(busyTimeMap.get(timeKey));
|
||||
artificerTime.setArtificerId(artificer.getArtificerId());
|
||||
artificerTime.setClassify(2);
|
||||
artificerTime.setCreateTime(DateUtils.format(new Date()));
|
||||
baseMapper.insert(artificerTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(busyTime)){
|
||||
for(String times:busyTime.split(",")){
|
||||
String[] datetime = times.split(" ");
|
||||
if(datetime!=null && datetime.length>0){
|
||||
Integer counts = baseMapper.selectCount(new QueryWrapper<ArtificerTime>().eq("artificer_date", datetime[0]).eq("artificer_id", artificer.getArtificerId()).eq("artificer_time", datetime[1]));
|
||||
if(counts==0){
|
||||
ArtificerTime artificerTime=new ArtificerTime();
|
||||
artificerTime.setArtificerDate(datetime[0]);
|
||||
artificerTime.setArtificerTime(datetime[1]);
|
||||
artificerTime.setArtificerId(artificer.getArtificerId());
|
||||
artificerTime.setClassify(2);
|
||||
artificerTime.setCreateTime(DateUtils.format(new Date()));
|
||||
baseMapper.insert(artificerTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
private Map<String,Map> getBusyMap(Map<String,List> dateMap){
|
||||
Map<String,Map> map = new HashMap();
|
||||
for (String key : dateMap.keySet()) {
|
||||
List<String> timeList = dateMap.get(key);
|
||||
Map allTimes = getTimeMap();
|
||||
for(int i=0; i < timeList.size();i++){
|
||||
String time = timeList.get(i);
|
||||
if(allTimes.get(time)!=null){
|
||||
allTimes.remove(time);
|
||||
}
|
||||
}
|
||||
map.put(key,allTimes);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map getTimeMap(){
|
||||
Map<String,String> map = new HashMap();
|
||||
for(int i=0;i<24;i++){
|
||||
String s = "";
|
||||
if(i<10){
|
||||
s = "0"+i+":";
|
||||
}else{
|
||||
s = i+":";
|
||||
}
|
||||
map.put(s+"00",s+"00");
|
||||
map.put(s+"30",s+"30");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String idleTime = "2024-08-28 12:00,2024-08-28 13:00,2024-08-28 14:00,2024-08-28 15:00,2024-08-28 16:00,2024-08-28 17:00,2024-08-28 18:00,2024-08-28 19:00,2024-08-28 20:00,2024-08-28 21:00,2024-08-28 22:00,2024-08-28 23:00,2024-08-29 00:30,2024-08-29 01:30,2024-08-29 02:30,2024-08-29 03:30,2024-08-29 04:30,2024-08-29 05:30,2024-08-29 06:30,2024-08-29 07:30,2024-08-29 08:30,2024-08-29 09:30";
|
||||
|
||||
Map<String,List> dateMap = new HashMap();
|
||||
for(String times:idleTime.split(",")){
|
||||
String[] datetime = times.split(" ");
|
||||
if(datetime!=null && datetime.length>0) {
|
||||
if(dateMap.get(datetime[0])!=null){
|
||||
List<String> timeList = dateMap.get(datetime[0]);
|
||||
timeList.add(datetime[1]);
|
||||
}else{
|
||||
List<String> timeList = new ArrayList<>();
|
||||
timeList.add(datetime[1]);
|
||||
dateMap.put(datetime[0],timeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,Map> map = new HashMap();
|
||||
for (String key : dateMap.keySet()) {
|
||||
List<String> timeList = dateMap.get(key);
|
||||
Map<String,String> allTimes = new HashMap();
|
||||
for(int i=0;i<24;i++){
|
||||
String s = "";
|
||||
if(i<10){
|
||||
s = "0"+i+":";
|
||||
}else{
|
||||
s = i+":";
|
||||
}
|
||||
allTimes.put(s+"00",s+"00");
|
||||
allTimes.put(s+"30",s+"30");
|
||||
}
|
||||
for(int i=0; i < timeList.size();i++){
|
||||
String time = timeList.get(i);
|
||||
if(allTimes.get(time)!=null){
|
||||
allTimes.remove(time);
|
||||
}
|
||||
}
|
||||
map.put(key,allTimes);
|
||||
}
|
||||
|
||||
for (String key : map.keySet()) {
|
||||
Map<String,String> busyTimeMap = map.get(key);
|
||||
for (String timeKey : busyTimeMap.keySet()) {
|
||||
System.out.print(key);
|
||||
System.out.print(" ");
|
||||
System.out.print(busyTimeMap.get(timeKey));
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result setArtificerAccept(Integer flag,Long userId){
|
||||
Artificer artificer = artificerService.selectArtificerByUserId(userId);
|
||||
Artificer artificer2 = new Artificer();
|
||||
artificer2.setAcceptOrders(flag);
|
||||
artificer2.setArtificerId(artificer.getArtificerId());
|
||||
artificerService.updateById(artificer2);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
|
@ -66,4 +66,29 @@ public class YwyApplyController {
|
|||
return service.findUserPage(ywyApply);
|
||||
}
|
||||
|
||||
@GetMapping("/invitationQdsPage")
|
||||
@ApiOperation("绑定渠道查询(分页)")
|
||||
public Result invitationQdsPage(YwyApply ywyApply){
|
||||
return service.invitationQdsPage(ywyApply);
|
||||
}
|
||||
|
||||
@GetMapping("/invitationQdsNotBindPage")
|
||||
@ApiOperation("未绑定渠道查询(分页)")
|
||||
public Result invitationQdsNotBindPage(YwyApply ywyApply){
|
||||
return service.invitationQdsNotBindPage(ywyApply);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteQds")
|
||||
@ApiOperation("取消渠道商")
|
||||
public Result deleteQds(YwyApply ywyApply){
|
||||
service.deleteQds(ywyApply);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/addQds")
|
||||
@ApiOperation("邀请渠道商")
|
||||
public Result addQds(YwyApply ywyApply){
|
||||
service.addQds(ywyApply);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,8 @@ public interface YwyApplyDao extends BaseMapper<YwyApply> {
|
|||
int approve(YwyApply ywyApply);
|
||||
int updateRate(YwyApply ywyApply);
|
||||
IPage<YwyApply> findUserPage(Page<YwyApply> page, @Param("params") YwyApply ywyApply);
|
||||
IPage<YwyApply> invitationQdsPage(Page<YwyApply> page, @Param("params") YwyApply ywyApply);
|
||||
IPage<YwyApply> invitationQdsNotBindPage(Page<YwyApply> page, @Param("params") YwyApply ywyApply);
|
||||
int deleteQds(YwyApply ywyApply);
|
||||
int addQds(YwyApply ywyApply);
|
||||
}
|
|
@ -11,4 +11,8 @@ public interface YwyApplyService extends IService<YwyApply> {
|
|||
int approve(YwyApply ywyApply);
|
||||
int updateRate(YwyApply ywyApply);
|
||||
Result findUserPage(YwyApply ywyApply);
|
||||
Result invitationQdsPage(YwyApply ywyApply);
|
||||
Result invitationQdsNotBindPage(YwyApply ywyApply);
|
||||
int deleteQds(YwyApply ywyApply);
|
||||
int addQds(YwyApply ywyApply);
|
||||
}
|
|
@ -77,4 +77,26 @@ public class YwyApplyServiceImpl extends ServiceImpl<YwyApplyDao, YwyApply> impl
|
|||
return Result.success().put("data",new PageUtils(baseMapper.findUserPage(pages,ywyApply)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result invitationQdsPage(YwyApply ywyApply){
|
||||
Page<YwyApply> pages=new Page<>(ywyApply.getUserPage(),ywyApply.getUserLimit());
|
||||
return Result.success().put("data",new PageUtils(baseMapper.invitationQdsPage(pages,ywyApply)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result invitationQdsNotBindPage(YwyApply ywyApply){
|
||||
Page<YwyApply> pages=new Page<>(ywyApply.getUserPage(),ywyApply.getUserLimit());
|
||||
return Result.success().put("data",new PageUtils(baseMapper.invitationQdsNotBindPage(pages,ywyApply)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteQds(YwyApply ywyApply){
|
||||
return baseMapper.deleteQds(ywyApply);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addQds(YwyApply ywyApply){
|
||||
return baseMapper.addQds(ywyApply);
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
<mapper namespace="com.sqx.modules.bl.commission.ywy.dao.YwyApplyDao">
|
||||
|
||||
<select id="findPage" resultType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
||||
select a.id,a.user_id,b.avatar,b.user_name,a.name,a.phone,a.remarks,a.create_time,a.status,a.opinion,a.rate,agent.user_name as agentName
|
||||
select a.id,a.user_id,b.avatar,b.user_name,a.name,a.phone,a.remarks,a.create_time,a.status,a.opinion,a.rate,agent.user_name as agentName,b.invitation_code
|
||||
from bl_ywy_apply a
|
||||
inner join tb_user b on a.user_id = b.user_id
|
||||
left join tb_user agent on b.bl_dls_code = agent.invitation_code
|
||||
|
@ -79,4 +79,46 @@
|
|||
order by b.user_id
|
||||
</select>
|
||||
|
||||
<select id="invitationQdsPage" resultType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
||||
select b.user_id,b.avatar,b.user_name,b.phone,b.invitation_code
|
||||
from tb_user b
|
||||
where b.status = 1
|
||||
and b.bl_is_qds = 1
|
||||
and b.bl_ywy_code = #{params.invitationCode}
|
||||
<if test="params.userName!=null and params.userName!=''">
|
||||
and b.user_name like concat('%',#{params.userName},'%')
|
||||
</if>
|
||||
<if test="params.phone!=null and params.phone!=''">
|
||||
and b.phone like concat('%',#{params.phone},'%')
|
||||
</if>
|
||||
order by b.user_id
|
||||
</select>
|
||||
|
||||
<select id="invitationQdsNotBindPage" resultType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
||||
select b.user_id,b.avatar,b.user_name,b.phone,b.invitation_code
|
||||
from tb_user b
|
||||
where b.status = 1
|
||||
and b.bl_is_qds = 1
|
||||
and ifnull(b.bl_ywy_code,'') = ''
|
||||
<if test="params.userName!=null and params.userName!=''">
|
||||
and b.user_name like concat('%',#{params.userName},'%')
|
||||
</if>
|
||||
<if test="params.phone!=null and params.phone!=''">
|
||||
and b.phone like concat('%',#{params.phone},'%')
|
||||
</if>
|
||||
order by b.user_id
|
||||
</select>
|
||||
|
||||
<update id="deleteQds" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
||||
update tb_user
|
||||
set bl_ywy_code = null
|
||||
where user_id=#{userId}
|
||||
</update>
|
||||
|
||||
<insert id="addQds" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
||||
update tb_user
|
||||
set bl_ywy_code = #{invitationCode}
|
||||
where user_id=#{userId}
|
||||
</insert>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue