修改手环箱子id

This commit is contained in:
haozq 2024-08-07 10:18:57 +08:00
parent 5a0084306a
commit 9a4ae6ecf6
12 changed files with 197 additions and 30 deletions

View File

@ -28,4 +28,6 @@ public class BoxEntity {
private long teamId;
private String curryDay;
}

View File

@ -26,8 +26,26 @@ public class BraceletEntity {
* 用户id
*/
private String userId;
/**
* 设备id
*/
private String devId;
/**
* 手机号码
*/
private String phone;
/**
* 身份证号码
*/
private String idCard;
/**
* 人员类型
*/
private String userType;
/**
* 手环编号
*/
private String shCode;
}

View File

@ -0,0 +1,39 @@
package com.bonus.gateway.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.WebFilter;
@Configuration
public class ContextPathConfig {
@Bean
@ConditionalOnProperty("server.servlet.context-path")
@Order(Ordered.HIGHEST_PRECEDENCE)
public WebFilter contextPathWebFilter(ServerProperties serverProperties){
String contextPath = serverProperties.getServlet().getContextPath();
return (serverWebExchange, webFilterChain) ->{
ServerHttpRequest request = serverWebExchange.getRequest();
String requestPath = request.getURI().getPath();
if(requestPath.contains(contextPath)){
String newPath = requestPath.replaceFirst(contextPath+"/", "");
ServerHttpRequest newRequest = request.mutate()
.path(newPath).build();
return webFilterChain.filter(serverWebExchange.mutate()
.request(newRequest)
.build()
);
}else {
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
};
}
}

View File

@ -35,7 +35,7 @@ import java.util.concurrent.TimeUnit;
public class AuthFilter implements GlobalFilter, Ordered
{
@Value("${system.jie-enable}")
@Value("${system.jia-enable}")
public boolean jaData;
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);

View File

@ -2,7 +2,7 @@
server:
port: 18080
servlet:
context-path: zhgd
context-path: ljzhgd
# Spring
spring:
application:

View File

@ -39,14 +39,25 @@ public class BraceletController extends BaseController{
@GetMapping("getBoxListById")
@SysLog(title = "手环管理", businessType = OperaType.QUERY, module = "基础管理->手环管理", details = "查询手环列表")
public AjaxResult getBoxListById(BoxEntity entity) {
List<BoxEntity> list = service.getBoxListById(entity);
return AjaxResult.success(list);
return service.getBoxListById(entity);
}
/**
* 查询相关手环箱
* 分配信息
* @param entity
* @return
*/
@GetMapping("getBoxInfo")
@SysLog(title = "手环管理", businessType = OperaType.QUERY, module = "基础管理->手环管理", details = "查询手环列表")
public AjaxResult getBoxInfo(BoxEntity entity) {
return service.getBoxInfo(entity);
}
}

View File

@ -1,4 +1,7 @@
package com.bonus.app.controller;
/**
* 设备领用信息
*/
public class DevUseController {
}

View File

@ -1,9 +1,11 @@
package com.bonus.app.mapper;
import com.bonus.app.entity.BoxEntity;
import com.bonus.app.entity.BraceletEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 手环管理 数据层
@ -16,4 +18,12 @@ public interface BraceletMapper {
* @return
*/
List<BoxEntity> getBoxListById(BoxEntity entity);
List<BraceletEntity> getBoxInfo(BoxEntity entity);
/**
* 查询手环信息
* @param vo
*/
List<Map<String,String>> getBoxInfoDetails(BraceletEntity vo);
}

View File

@ -2,6 +2,7 @@ package com.bonus.app.service;
import com.bonus.app.entity.BoxEntity;
import com.bonus.app.entity.BraceletEntity;
import com.bonus.common.core.web.domain.AjaxResult;
import org.springframework.stereotype.Service;
import java.util.List;
@ -17,5 +18,12 @@ public interface BraceletService {
* @param entity
* @return
*/
List<BoxEntity> getBoxListById(BoxEntity entity);
AjaxResult getBoxListById(BoxEntity entity);
/**
* 查询当前手环箱 设备信息
* @param entity
* @return
*/
AjaxResult getBoxInfo(BoxEntity entity);
}

View File

@ -4,14 +4,21 @@ import com.bonus.app.config.RoleConfig;
import com.bonus.app.entity.BoxEntity;
import com.bonus.app.entity.BraceletEntity;
import com.bonus.app.mapper.BraceletMapper;
import com.bonus.common.core.utils.DateTimeHelper;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* app 接口实现层
@ -23,17 +30,63 @@ public class BraceletServiceImpl implements BraceletService{
@Autowired
private BraceletMapper mapper;
@Override
public List<BoxEntity> getBoxListById(BoxEntity entity) {
public AjaxResult getBoxListById(BoxEntity entity) {
try{
if (!DateTimeHelper.getNowDay().equals(entity.getCurryDay())) {
return AjaxResult.error("请求参数不正确");
}
LoginUser loginUser= SecurityUtils.getLoginUser();
String teamCode=loginUser.getSysUser().getRoleCode();
entity.setRoleCode(teamCode);
if(ObjectUtils.isEmpty((loginUser.getSysUser().getTeamId()))){
entity.setTeamId(-99999L);
}else{
entity.setTeamId(loginUser.getSysUser().getTeamId());
}
List<BoxEntity> list=mapper.getBoxListById(entity);
return list;
return AjaxResult.success(list);
}catch (Exception e){
log.error(e.toString());
}
return new ArrayList<>();
return AjaxResult.error("系统异常");
}
/**
* 查询手环箱信息
* @param entity
* @return
*/
@Override
public AjaxResult getBoxInfo(BoxEntity entity) {
try{
if (StringUtils.isEmpty(entity.getBoxId())){
return AjaxResult.error("请求参数不正确");
}
//查询手环数据信息
List<BraceletEntity> list=mapper.getBoxInfo(entity);
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
List<CompletableFuture<?>> futures = new ArrayList<>();
for (BraceletEntity vo:list){
CompletableFuture<?> future = CompletableFuture.runAsync(() -> {
mapper.getBoxInfoDetails(vo);
}, executor);
futures.add(future);
}
//数据处理->查询属性值高空作业信息
// 等待所有任务完成
CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0])).join();
// 关闭ExecutorService
executor.shutdown();
}catch (Exception e){
log.error(e.toString());
}
return AjaxResult.error("系统异常");
}
}

View File

@ -2,11 +2,8 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.app.mapper.BraceletMapper">
<select id="getBoxListById" resultType="com.bonus.app.entity.BoxEntity">
<select id="getBoxListById" resultType="com.bonus.app.entity.BoxEntity" >
select id boxId,box_name boxName
FROM tb_sh_box
WHERE team_id is not null
@ -14,4 +11,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and team_id=#{teamId}
</if>
</select>
<select id="getBoxInfo" resultType="com.bonus.app.entity.BraceletEntity">
select blt.sh_code shCode,blt.id devId,peopel_type userType,
case
WHEN peopel_type=0 then tpe.name
WHEN peopel_type=1 then tlu.name
ELSE ''
END AS user_name ,
case
WHEN peopel_type=0 then tpe.phone
WHEN peopel_type=1 then tlu.phone
ELSE ''
END AS phone ,
case
WHEN peopel_type=0 then tpe.id_card
WHEN peopel_type=1 then tlu.id_card
ELSE ''
END AS id_card
FROM tb_bracelet blt
left join tb_people tpe on blt.bid_id=blt.id and peopel_type=0
left join tb_ls_user tlu on blt.bid_id=tlu.id and peopel_type=1
where blt.box_id=#{boxId}
</select>
<select id="getBoxInfoDetails" resultType="java.util.Map">
</select>
</mapper>

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select tb.id as shId,tb.sh_code as shCode,sh_status as shStatus,tsb.box_name as shboxName,
tsb.box_code as shboxCode,tb.peopel_type as shPersonType,tb.bid_id as shPersonId,tsb.id as shboxId
from tb_bracelet tb
left join tb_sh_box tsb on tb.box_ix = tsb.id and tsb.del_flag = 0
left join tb_sh_box tsb on tb.box_id = tsb.id and tsb.del_flag = 0
where tb.del_flag = 0
<if test="shCode != null and shCode!=''">
AND INSTR(tb.sh_code,#{shCode}) > 0
@ -27,10 +27,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--手环箱绑定手环列表-->
<select id="getShBindLists" resultType="com.bonus.common.entity.bracelet.vo.BraceletVo">
select id as shId,sh_code as shCode,box_ix as shboxId,bid_id as shPersonId,
select id as shId,sh_code as shCode,box_id as shboxId,bid_id as shPersonId,
peopel_type as shPersonType,sh_status as shStatus
from tb_bracelet tb
where tb.del_flag = 0 and tb.box_ix = #{shboxId}
where tb.del_flag = 0 and tb.box_id = #{shboxId}
<if test="shCode != null and shCode!=''">
AND INSTR(tb.sh_code,#{shCode}) > 0
</if>
@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getShBindNoLists" resultType="com.bonus.common.entity.bracelet.vo.BraceletVo">
select id as shId,sh_code as shCode
from tb_bracelet
where box_ix is NULL and del_flag = 0
where box_id is NULL and del_flag = 0
order by id ASC
</select>
@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getShboxLists" resultType="com.bonus.common.entity.bracelet.vo.ShboxVo">
select tsb.id as shboxId, tsb.box_name as shboxName,tsb.box_code as shboxCode,tsb.box_capacity as shboxCapacity,count(tb.id) as shboxBindNum
from tb_sh_box tsb
left join tb_bracelet tb on tsb.id = tb.box_ix and tb.del_flag = 0
left join tb_bracelet tb on tsb.id = tb.box_id and tb.del_flag = 0
where tsb.del_flag = 0
group by tsb.id
order by tsb.id ASC
@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tsb.box_capacity as shboxCapacity,twt.team_leader as lyName
from tb_sh_box tsb
left join t_work_team twt on tsb.team_id = twt.team_id and twt.del_flag = 0
left join tb_bracelet tb on tsb.id = tb.box_ix and tb.del_flag = 0
left join tb_bracelet tb on tsb.id = tb.box_id and tb.del_flag = 0
where tsb.del_flag = 0
<if test="shboxName != null and shboxName!=''">
AND INSTR(tsb.box_name,#{shboxName}) > 0
@ -97,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getShboxBindLists" resultType="com.bonus.common.entity.bracelet.vo.ShboxVo">
select tsb.id as shboxId, tsb.box_name as shboxName,tsb.box_code as shboxCode,tsb.box_capacity as shboxCapacity,count(tb.id) as shboxBindNum
from tb_sh_box tsb
left join tb_bracelet tb on tsb.id = tb.box_ix and tb.del_flag = 0
left join tb_bracelet tb on tsb.id = tb.box_id and tb.del_flag = 0
where tsb.del_flag = 0
<if test="keyword != null and keyword!=''">
AND (INSTR(tsb.box_name,#{keyword}) > 0 or
@ -111,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateSh">
UPDATE tb_bracelet tb
set
box_ix = #{shboxId},
box_id = #{shboxId},
sh_status = #{shStatus},sh_code = #{shCode}
where id = #{shId}
</update>
@ -163,7 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--新增手环信息-->
<insert id="addSh" parameterType="com.bonus.common.entity.bracelet.vo.ShboxVo" >
insert into tb_bracelet(
<if test="shboxId != null">box_ix,</if>
<if test="shboxId != null">box_id,</if>
<if test="shCode != null and shCode != ''">sh_code,</if>
<if test="shStatus != null ">sh_status,</if>
del_flag
@ -193,14 +193,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--手环绑定选择页面绑定手环信息-->
<update id="addShBind">
UPDATE tb_bracelet
SET box_ix = #{shboxId},bid_time = now(),sh_status = 0
SET box_id = #{shboxId},bid_time = now(),sh_status = 0
where id = #{shId}
</update>
<!--解除绑定-->
<update id="delSh">
UPDATE tb_bracelet
SET box_ix = null,sh_status = 1
SET box_id = null,sh_status = 1
where id = #{shId}
</update>
@ -228,7 +228,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBoxNewById" parameterType="int" resultType="com.bonus.common.entity.bracelet.vo.ShboxVo">
select tsb.id as shboxId, tsb.box_name as shboxName,tsb.box_code as shboxCode,tsb.box_capacity as shboxCapacity,count(tb.id) as shboxBindNum
from tb_sh_box tsb
left join tb_bracelet tb on tsb.id = tb.box_ix and tb.del_flag = 0
left join tb_bracelet tb on tsb.id = tb.box_id and tb.del_flag = 0
where tsb.del_flag = 0 and tsb.id = #{shboxId}
group by tsb.id
order by tsb.id ASC
@ -237,7 +237,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--绑定-->
<update id="bindSh">
UPDATE tb_bracelet
SET box_ix = #{shboxId},sh_status = 0
SET box_id = #{shboxId},sh_status = 0
where id = #{shId}
</update>
</mapper>