Commit 0fd20fdc by 李小惠

Merge branch 'develop' of http://gitlab.sothing.top/843502640/jyzb_platformV2 into develop-lxh

# Conflicts:
#	jyzb-biz/src/main/java/com/junmp/jyzb/controller/PoliceController.java
#	jyzb-biz/src/main/java/com/junmp/jyzb/service/PolicemanService.java
#	jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/PolicemanServiceImpl.java
parents e8b03fb3 67d1bc33
......@@ -46,4 +46,6 @@
</dependencies>
</project>
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
@Data
public class OrgDto {
private Long orgId;
private String orgName;
private String orgCode;
private Integer isDepartment;
private Long orgParentId;
private String areaName;
private String levelFlag;
private String dName;
}
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class OrgTreeDto {
public class OrgTreeDto implements Serializable {
private Long orgId;
private String name;
private String code;
private Integer type;
private List<OrgTreeDto> child = new ArrayList<>();
private Long orgParentId;
private String areaName;
private String levelFlag;
private String dName;
private transient List<OrgTreeDto> child = new ArrayList<>();
public void addChild(OrgTreeDto child) {
this.child.add(child);
}
public OrgTreeDto copyIngnoreChildren() {
OrgTreeDto desBean = new OrgTreeDto();
BeanUtils.copyProperties(this, desBean, "children", "info");
return desBean;
}
}
......
......@@ -5,9 +5,13 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
//@EqualsAndHashCode(callSuper = true)
//@EqualsAndHashCode(callSuper = false)
public class QueryOrgReq {
private String orgCode;
private String orgId;
private String parentId;
private Integer isDepartment;
private Integer level;
}
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.common.bean.request.ValidationApi;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class OrgUpdateReq extends BaseRequest {
public class UpdateOrgReq {
/**
* 状态
*/
@NotBlank(message = "状态不能为空", groups = {ValidationApi.edit.class})
private String statusFlag;
@NotBlank(message = "状态不能为空", groups = {ValidationApi.updateStatus.class})
private Integer statusFlag;
/**
* 组织机构列表
*/
private List<orgIdList> orgIdList;
private class orgIdList {
/**
* 状态
*/
@NotBlank(message = "组织机构id不能为空", groups = {ValidationApi.edit.class})
private int id;
}
private List<String> orgIdList;
}
package com.junmp.jyzb.api.exception.enums;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.v2.common.constant.CommonConstant;
import com.junmp.v2.common.exception.IExceptionEnum;
import lombok.Getter;
@Getter
public enum OrgExceptionEnum implements IExceptionEnum {
/**
* 装备不存在
*/
ORG_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 13, "{}");
/**
* 错误编码
*/
private final Integer code;
/**
* 提示用户信息
*/
private final String message;
OrgExceptionEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}
......@@ -46,12 +46,12 @@
<groupId>com.junmp.v2</groupId>
<artifactId>auth-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-log-api</artifactId>
......@@ -70,9 +70,5 @@
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-api</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-api</artifactId>
</dependency>
</dependencies>
</project>
......@@ -77,12 +77,7 @@ public class CabinetController {
return ApiRes.success(cabinetService.showOneCabinet(req));
}
@PostMapping("/GetCabinetByOrgId")
@ApiOperation("根据组织机构获取单警柜及箱号信息")
public ResponseResult getCabinetByOrgId(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = cabinetService.getCabinetByOrgId(msg);
return returnMsg;
}
@PostMapping("/ShowCabinetList")
@ApiOperation("查询单警柜列表")
public ApiRes<List<CabinetDto>> showCabinetList(@RequestBody CabinetReq req){
......
......@@ -29,7 +29,7 @@ public class EquipmentSizeController {
@PostMapping("/AddSize")
@ApiOperation("添加号型信息")
public ApiRes<Boolean> addSize(@RequestBody @Validated(ValidationApi.add.class) UpdateEquipmentSizeReq req) {
public ApiRes<String> addSize(@RequestBody @Validated(ValidationApi.add.class) UpdateEquipmentSizeReq req) {
return ApiRes.success(equipmentSizeService.addSize(req));
}
......
......@@ -28,7 +28,7 @@ public class EquipmentTypeController {
@PostMapping("/AddEquipment")
@ApiOperation("添加物资")
public ApiRes<Boolean> addEquipment(@RequestBody @Validated(ValidationApi.add.class) UpdateEquipmentTypeReq req) {
public ApiRes<String> addEquipment(@RequestBody @Validated(ValidationApi.add.class) UpdateEquipmentTypeReq req) {
return ApiRes.success(equipmentTypeService.addEquipment(req));
}
......
......@@ -66,12 +66,6 @@ public class PoliceController {
return ApiRes.success(b);
}
// @PostMapping("/ShowPolice")
// @ApiOperation("查询警员列表") //根据组织机构id查询
// public ResponseResult getAllPoliceman(@RequestBody Map<String, Object> orgId){
// ResponseResult returnMsg = policemanService.getAllPoliceman(orgId);
// return returnMsg;
// }
//根据组织机构id查询,只查询本级,不包含下级
......
package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.dto.OrgDto;
import com.junmp.jyzb.api.bean.dto.OrgTreeDto;
import com.junmp.jyzb.api.bean.query.ProductSkuReq;
import com.junmp.jyzb.api.bean.query.QueryOrgReq;
import com.junmp.jyzb.api.bean.req.UpdateOrgReq;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.lang.Nullable;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
......@@ -25,14 +28,7 @@ public class PubOrgController {
@Resource
public PubOrgService pubOrgService;
@PostMapping("/ShowPubOrgList")
@ApiOperation("查询组织机构列表_简化版")
public ApiRes<List<Map<String,Object>>> ShowEquipmentList(@RequestBody Map<String, Object> orgId) {
return ApiRes.success(pubOrgService.showPubOrgList(orgId));
}
@PostMapping("/SetOrgParentIds")
@GetMapping("/SetOrgParentIds")
@ApiOperation("填充组织机构的parent_ids字段")
public ResponseResult setOrgParentIds() {
//传入当前的组织机构id,展示所有本级及下级的
......@@ -47,18 +43,19 @@ public class PubOrgController {
return returnMsg;
}
@PostMapping("/GetOrgDetail")
@ApiOperation("查询组织机构详细信息")
public List<OrgTreeDto> getOrgDetail(@RequestBody QueryOrgReq req) {
List<OrgTreeDto> returnMsg = pubOrgService.getOrgList(req);
return returnMsg;
@PostMapping("/GetOrgList")
@ApiOperation("查询组织树形结构")
public ApiRes<List<OrgTreeDto>> getOrgList(@RequestBody QueryOrgReq req) {
return ApiRes.success(pubOrgService.getOrgList(req));
}
@PostMapping("/GetLowerOrg")
@ApiOperation("获取本级及下级的组织机构")
public ResponseResult getLowerOrg(@RequestBody Map<String, Object> msg) {
String orgId = msg.get("orgId").toString();
List<String> returnMsg = pubOrgService.getLowerOrg(orgId);
return new ResponseResult(99200,"操作成功",returnMsg);
@PostMapping("/ChangeOrgState")
@ApiOperation("改变组织机构状态信息")
public ApiRes<Boolean> changeOrgState(@RequestBody @Validated(ValidationApi.edit.class) UpdateOrgReq req) {
return ApiRes.success(pubOrgService.ChangeState(req));
}
@PostMapping("/GetLowOrg")
@ApiOperation("根据组织机构查询下一级信息")
public ApiRes<List<OrgDto>> getLowOrg(@RequestBody QueryOrgReq req) {
return ApiRes.success(pubOrgService.getLowOrg(req)) ;
}
}
......@@ -29,7 +29,7 @@ public class SupplierController {
@PostMapping("/AddSupplier")
@ApiOperation("添加供应商")
public ApiRes<Boolean> AddSupplier(@RequestBody @Validated(ValidationApi.add.class) UpdateSupplierReq req) {
public ApiRes<String> AddSupplier(@RequestBody @Validated(ValidationApi.add.class) UpdateSupplierReq req) {
return ApiRes.success(supplierService.AddSupplier(req));
}
......
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.MsgService;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -16,22 +16,7 @@ import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/User")
@Api(tags = "根据表明和组织机构id获取相关信息")
@Api(tags = "用户表")
public class UserController {
@Resource
public MsgService msgService;
@PostMapping("/GetMsg")
@ApiOperation("获取相关信息")
public ResponseResult getMsg(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = msgService.getMsg(msg);
return returnMsg;
}
@PostMapping("/GetUserMsg")
@ApiOperation("根据组织机构获取用户信息")
public ResponseResult getUserMsg(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = msgService.getUserMsg(msg);
return returnMsg;
}
}
......@@ -25,6 +25,12 @@ public class PubOrg implements Serializable {
*/
@TableId(type = IdType.AUTO, value = "org_id")
private Long orgId;
/**
* 主键
*/
@TableField(value = "is_department")
private Integer isDepartment;
/**
* 父id,一级节点父id是0
......@@ -61,7 +67,6 @@ public class PubOrg implements Serializable {
*/
@TableField(value = "sort_val")
private Integer sortVal;
/**
* 状态:1-启用,0-禁用
*/
......@@ -194,5 +199,5 @@ public class PubOrg implements Serializable {
@TableField(value = "org_name")
private String orgName;
// private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.enums;
import lombok.Getter;
/**
* 消息类型
*
* @author FCG
*/
@Getter
public enum MsgType {
/**
* news,有效时间24h
*/
News("news", 24 * 60 * 60 * 1000),
Video("video", 24 * 60 * 60 * 1000),
Goods("goods", 7 * 24 * 60 * 60 * 1000);
private String name;
/**
* time to live,(ms)
*/
private long ttl;
MsgType(String name, long ttl) {
this.name = name;
this.ttl = ttl;
}
}
\ No newline at end of file
......@@ -12,42 +12,8 @@ import java.util.Map;
@Mapper
public interface CabinetMapper extends BaseMapper<Cabinet> {
public int addCabinet(Cabinet cabinet);
List<Cabinet> getAllCabinetByOrgList(@Param("allOrgId") List<String> allOrgId);
public List<Cabinet> getAllCabinet();
public List<Cabinet> getAllCabinetList();
Map<String, Object> getOneCabinet(String id);
void updateCabinet(Cabinet cabinet);
List<String> getAllCabinetId(String orgId);
void changeCabinetState(Cabinet cabinet);
List<String> getAllCabinetBoxId(String id);
List<String> getAllCabinetIdByHighest();
String getCabinetNumById(String id);
List<Cabinet> getAllCabinetByOrgList(List<String> allOrgId);
void setCabinetSumInventory(@Param("updateId") String id);
void setCabinetInSumInventory(@Param("updateId") String id);
void setCabinetOutSumInventory(@Param("updateId") String id);
void setCabinetPriceInventory(@Param("updateId") String id);
List<Map<String, Object>> getCabinetByOrgId(String orgId);
String getOrgByCabinet(String cabinetId);
}
\ No newline at end of file
......@@ -11,9 +11,4 @@ import java.util.Map;
@Mapper
public interface PoliceFingerMapper extends BaseMapper<PoliceFinger> {
List<Map<String, Object>> getFingersByUserId(String userId);
void addFingers(PoliceFinger fingers);
void updateFingers(PoliceFinger finger);
}
\ No newline at end of file
......@@ -13,27 +13,8 @@ public interface PolicemanMapper extends BaseMapper<Policeman> {
Map<String, Object> getOnePolice(String id);
List<String> getAllPoliceId(String orgId);
void deleteFinger(String fingerId);
List<String> getAllPoliceIdByBoxId(String boxId);
void addFaceInfo(Policeman police);
List<String> getChildren(String id);
List<String> getAllBoxIdByCabinet(String cabinetId);
List<Map<String,Object>> getAllPolice();
List<String> getAllPoliceIdByHighest();
String getPoliceCodeById(String id);
List<Map<String, Object>> getAllPolicemanByOrg(String orgId);
......
......@@ -12,19 +12,9 @@ import java.util.Map;
public interface PubOrgMapper extends BaseMapper<PubOrg> {
List<PubOrg> selectAllOrg();
Long getOnePubOrg(String orgId);
void setMsg(@Param("id") Long id,@Param("orgName") String orgName);
void setOrgParentIds();
void wipeParentIdsData();
Map<String, Object> getOrgDetail(String orgId);
String getParentOrgName(Long orgParentId);
List<PubOrg> showAllPubOrgList();
void changeOrgState(@Param("statusFlag") Integer statusFlag,List<String> orgIdList);
}
\ No newline at end of file
......@@ -11,8 +11,6 @@ import java.util.Map;
public interface CabinetBoxService extends IService<CabinetBox> {
List<Map<String, Object>> getAllBoxMsg(String id);
List<CabinetBox> getCabinetBoxList(CabinetReq req);
......
......@@ -14,17 +14,6 @@ import java.util.Map;
public interface CabinetService extends IService<Cabinet> {
List<String> getAllCabinetId(Map<String, Object> orgId);
Map<String, Object> getOneCabinet(String cabinetId);
List<String> getAllCabinetBoxId(String id);
ResponseResult setCabinetInventory(Map<String, Object> msg);
/**
......@@ -71,12 +60,6 @@ public interface CabinetService extends IService<Cabinet> {
*/
boolean boxBindPolice(CabinetBoxReq req);
/**
* 根据组织机构获取单警柜及箱号信息
* @param msg
* @return
*/
ResponseResult getCabinetByOrgId(Map<String, Object> msg);
/**
* 修改单警柜箱门状态
......
......@@ -10,7 +10,7 @@ import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
public interface EquipmentSizeService extends IService<EquipmentSize> {
Boolean addSize(UpdateEquipmentSizeReq req);
String addSize(UpdateEquipmentSizeReq req);
EquipmentSize getOneSize(QueryEquipmentSizeReq req);
......
......@@ -13,7 +13,7 @@ import java.util.Map;
public interface EquipmentTypeService extends IService<EquipmentType> {
Boolean addEquipment(UpdateEquipmentTypeReq req );
String addEquipment(UpdateEquipmentTypeReq req );
Boolean deleteEquipment(UpdateEquipmentTypeReq req);
......
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.Map;
public interface MsgService {
ResponseResult getMsg(Map<String, Object> msg);
ResponseResult getUserMsg(Map<String, Object> msg);
}
......@@ -11,8 +11,6 @@ import java.util.Map;
public interface PoliceFingerService extends IService<PoliceFinger> {
List<Map<String, Object>> getFingersByUserId(String userId);
/**
* 新增指纹信息
* @param req
......
......@@ -6,19 +6,19 @@ import com.junmp.jyzb.api.bean.dto.PolicemanDto;
import com.junmp.jyzb.api.bean.query.PolicemanReq;
import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq;
import com.junmp.jyzb.entity.Policeman;
import com.junmp.jyzb.utils.ResponseResult;
public interface PolicemanService extends IService<Policeman> {
//添加警员
String AddPoliceman(UpdatePolicemanReq req);
import java.util.List;
import java.util.Map;
public interface PolicemanService extends IService<Policeman> {
//获取单个警员信息
PolicemanDto GetOnePolice(PolicemanReq req);
//删除警员
boolean DeletePolice(UpdatePolicemanReq req);
//获取单个警员信息
PolicemanDto GetOnePolice(PolicemanReq req);
//修改警员信息
......@@ -51,3 +51,14 @@ public interface PolicemanService extends IService<Policeman> {
}
Policeman SearchFaceInfo(PolicemanReq req);
boolean PoliceBindUser(PolicemanReq req);
boolean PoliceBindBox(PolicemanReq req);
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.dto.OrgDto;
import com.junmp.jyzb.api.bean.dto.OrgTreeDto;
import com.junmp.jyzb.api.bean.query.QueryOrgReq;
import com.junmp.jyzb.api.bean.req.OrgUpdateReq;
import com.junmp.jyzb.api.bean.req.UpdateOrgReq;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
......@@ -12,8 +13,6 @@ import com.junmp.jyzb.entity.PubOrg;
public interface PubOrgService extends IService<PubOrg> {
List<Map<String,Object>> showPubOrgList(Map<String, Object> orgId);
ResponseResult setShortName(Map<String, Object> orgId);
......@@ -22,6 +21,8 @@ public interface PubOrgService extends IService<PubOrg> {
ResponseResult setOrgParentIds();
List<OrgTreeDto> getOrgList(QueryOrgReq req);
// public List<OrgTreeDto> getEquipmentList(QueryOrgReq req)
ResponseResult changeOrgState(OrgUpdateReq req);
List<OrgDto> getLowOrg(QueryOrgReq req);
Boolean ChangeState(UpdateOrgReq req);
}
......@@ -14,7 +14,7 @@ public interface SupplierService extends IService<Supplier> {
*
* @param req
*/
boolean AddSupplier(UpdateSupplierReq req);
String AddSupplier(UpdateSupplierReq req);
/**
* @Author: Zhaojw
......
......@@ -30,21 +30,8 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private CabinetBoxService cabinetBoxService;
@Resource
private PolicemanMapper policemanMapper;
@Resource
private PoliceFingerMapper policeFingerMapper;
@Resource
private CabinetService cabinetService;
@Override
public List<Map<String, Object>> getAllBoxMsg(String id) {
return cabinetBoxMapper.getBoxMsg(id);
}
/**
* @author lxh
......@@ -55,7 +42,7 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
**/
@Override
public List<CabinetBox> getCabinetBoxList(CabinetReq req) {
List<CabinetBox> cabinetBoxList = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
List<CabinetBox> cabinetBoxList = this.list(new LambdaQueryWrapper<CabinetBox>()
.eq(ObjectUtil.isNotEmpty(req.getId()),CabinetBox::getCabinetId, req.getId()));
return cabinetBoxList;
}
......@@ -64,7 +51,7 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
@Override
@Transactional(rollbackFor = Exception.class)
public boolean AddBoxInfo(UpdateCabinetBoxReq req) {
CabinetBox one = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>()
CabinetBox one = this.getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getId, req.getId()));
if (ObjectUtil.isNotNull(one)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS);
......
......@@ -36,22 +36,11 @@ import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> implements CabinetService {
@Resource
private RedisUtils redisUtils;
@Resource
private CabinetMapper cabinetMapper;
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private PolicemanMapper policemanMapper;
@Resource
private PubOrgMapper pubOrgMapper;
@Resource
private PubOrgService pubOrgService;
@Resource
private CabinetBoxService cabinetBoxService;
......@@ -59,38 +48,9 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Resource
private PolicemanService policemanService;
private static final String REDIS_CABINET = "Cabinet_";
@Override
public Map<String, Object> getOneCabinet(String id) {
return cabinetMapper.getOneCabinet(id);
}
//查询某组织机构的所有子机构
public List<String> getSubIds(String id) {
List<String> subIds = new ArrayList<>();
subIds.add(id);//先往List中放入父级id
List<String> subMenus = policemanMapper.getChildren(id);//查询该id的子类id
if (subMenus != null) {
for (String subMenu : subMenus) {
subIds.addAll(getSubIds(subMenu));
}
}
return subIds;
}
@Override
public List<String> getAllCabinetBoxId(String id) {
List<String> msg = cabinetMapper.getAllCabinetBoxId(id);
return msg;
}
private List<String> getAllOrgId(CabinetReq req, String includeLowerLevel) {
......@@ -110,45 +70,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return allCabinet;
}
@Override
public List<String> getAllCabinetId(Map<String, Object> msg) {
//如果组织机构是最高级的,获取所有id
if (msg.get("orgId").toString().equals("1369509498032808905")) {
//构建 Redis 缓存键
String redisKey = "getAllCabinetId_" + msg.get("IncludeLowerLevel") + '_' + msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
return cachedData;
}
List<String> allCabinetId = cabinetMapper.getAllCabinetIdByHighest();
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allCabinetId);
return allCabinetId;
}
//构建 Redis 缓存键
String redisKey = "getAllCabinetId_" + msg.get("IncludeLowerLevel") + '_' + msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
return cachedData;
}
List<String> cabinetId = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")) {
cabinetId = cabinetMapper.getAllCabinetId(msg.get("orgId").toString());
} else {
List<String> orgIds = getSubIds(msg.get("orgId").toString()); //调用本级及下级的所有组织机构的id
for (String orgId : orgIds) {
List<String> allPoliceId = cabinetMapper.getAllCabinetId(orgId);
cabinetId.addAll(allPoliceId);
}
}
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cabinetId);
return cabinetId;
}
public ResponseResult setCabinetInventory(Map<String, Object> msg) {
String id;
......@@ -158,13 +79,13 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
id = null;
}
//统计仓库 装备总数
cabinetMapper.setCabinetSumInventory(id);
//统计仓库 装备在库总数
cabinetMapper.setCabinetInSumInventory(id);
//统计仓库 装备出库总数
cabinetMapper.setCabinetOutSumInventory(id);
//统计仓库 装备出库总数
cabinetMapper.setCabinetPriceInventory(id);
// cabinetMapper.setCabinetSumInventory(id);
// //统计仓库 装备在库总数
// cabinetMapper.setCabinetInSumInventory(id);
// //统计仓库 装备出库总数
// cabinetMapper.setCabinetOutSumInventory(id);
// //统计仓库 装备出库总数
// cabinetMapper.setCabinetPriceInventory(id);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
......@@ -285,7 +206,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
List<CabinetBoxDto> cabinetBoxList=new ArrayList<>();
//如果组织机构时浙江省公安厅
if (req.getOrgId().equals("1369509498032808905") && req.getIncludeLowerLevel().equals("true")) {
cabinets = cabinetMapper.getAllCabinet();
cabinets = this.list(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getOrgId, req.getOrgId()));
for (Cabinet cabinet:cabinets) {
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(cabinet,cabinetDto);
......@@ -435,29 +357,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return policemanService.updateById(one2);
}
@Override
public ResponseResult getCabinetByOrgId(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
// 根据组织机构获取该组织机构下所有单警柜
List<Map<String,Object>> allCabinet = new ArrayList<>();
allCabinet = cabinetMapper.getCabinetByOrgId(msg.get("orgId").toString());
// 遍历allCabinet
for (Map<String,Object> oneCabinet:allCabinet){
String cabinetId = oneCabinet.get("id").toString();
// 根据单警柜id获取箱号信息
List<Map<String,Object>> allBox = new ArrayList<>();
allBox = cabinetBoxMapper.getBoxMsg(cabinetId);
oneCabinet.put("allBoxMsg",allBox);
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, allCabinet);
}
/**
* 修改单警柜箱门状态
......
......@@ -33,10 +33,13 @@ public class EquipmentSizeServiceImpl extends ServiceImpl<EquipmentSizeMapper, E
@Override
public Boolean addSize(UpdateEquipmentSizeReq req) {
public String addSize(UpdateEquipmentSizeReq req) {
EquipmentSize size = new EquipmentSize();
String sizeID=UUID.randomUUID().toString();
BeanPlusUtil.copyProperties(req, size);
return this.save(size);
size.setId(sizeID);
this.save(size);
return sizeID;
}
@Override
......
......@@ -77,9 +77,11 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
selfCode=id;
EquipmentType et=this.getById(id);
EquipmentTreeDto equipmentTypeDTO = new EquipmentTreeDto();
equipmentTypeDTO.setName(et.getName());
equipmentTypeDTO.setCode(et.getCode());
equipmentTypeDTO.setType(et.getType());
equipmentDtoMap.put(et.getId(),equipmentTypeDTO);
}
......@@ -124,7 +126,7 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
@Transactional
@Override
public Boolean addEquipment(UpdateEquipmentTypeReq req) {
public String addEquipment(UpdateEquipmentTypeReq req) {
EquipmentType type = new EquipmentType();
......@@ -151,7 +153,8 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
);
supplierTypeService.saveBatch(supplierType);
this.updateById(parentType);
return this.save(type);
this.save(type);
return String.valueOf(newcode);
} else {
String msg="以下供应商不存在:" +String.join(",", chekResult);
throw new JYZBAppException(EquipmentTypeExceptionEnum.SUPPLIER_NOT_EXIST, msg);
......
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.mapper.MsgMapper;
import com.junmp.jyzb.service.MsgService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class MsgServiceImpl implements MsgService {
@Resource
private MsgMapper msgMapper;
@Override
public ResponseResult getMsg(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("tableName"), "tableName不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String orgId = msg.get("orgId").toString();
String tableName = msg.get("tableName").toString();
List<Map<String,Object>> returnMsg = msgMapper.getMsg(orgId,tableName);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}
@Override
public ResponseResult getUserMsg(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String orgId = msg.get("orgId").toString();
List<Map<String,Object>> returnMsg = msgMapper.getUserMsg(orgId);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,returnMsg);
}
}
......@@ -29,10 +29,6 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
@Resource
private PoliceFingerMapper policeFingerMapper;
@Override
public List<Map<String, Object>> getFingersByUserId(String userId) {
return policeFingerMapper.getFingersByUserId(userId);
}
//新增指纹信息
@Override
......
......@@ -496,3 +496,85 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
}
}
/**
* @author lxh
* @description 查询人脸信息
* @since 2023/7/18 15:02
* @param
* @return
**/
@Override
public Policeman SearchFaceInfo(PolicemanReq req) {
//警员id不能为空
if (ObjectUtil.isEmpty(req.getId()) || ObjectUtil.isNull(req.getId())){
return null;
}
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(policeman)){
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
return policeman;
}
/**
* 警员绑定账号
* @param req
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean PoliceBindUser(PolicemanReq req) {
User user = new User();
BeanPlusUtil.copyProperties(req,user);
//密码加密,依赖注入错误
BcryptPasswordStoredEncrypt passwordStoredEncrypt = new BcryptPasswordStoredEncrypt();
String encrypt = passwordStoredEncrypt.encrypt(req.getPassword());
user.setPassword(encrypt);
//存储到数据库
//判断传入的sex是什么,需要做处理
if (req.getSex().equals("男")){
user.setSex("M");
}else{
user.setSex("F");
}
user.setRealName(req.getName());
user.setNickName(req.getName());
sysUserService.save(user);
//通过警员id将查询到的警员信息进行修改设置
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, req.getId()));
if (ObjectUtil.isNull(policeman)){
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
policeman.setUserId(user.getUserId());
policeman.setIsCreatedAccount(true);
policeman.setPassword(encrypt);
return policemanService.updateById(policeman);
}
//人员绑定箱门
@Override
public boolean PoliceBindBox(PolicemanReq req) {
Policeman policeman = new Policeman();
BeanPlusUtil.copyProperties(req,policeman);
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, req.getId()));
if (ObjectUtil.isNull(one)){
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
//判断箱子是否存在
CabinetBox cabinetBox = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getId, req.getCabinetBoxId()));
if (ObjectUtil.isNull(cabinetBox)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
return policemanService.updateById(policeman);
}
}
......@@ -25,11 +25,13 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
@Override
public boolean AddSupplier(UpdateSupplierReq req) {
public String AddSupplier(UpdateSupplierReq req) {
Supplier supplier = new Supplier();
req.setId(UUID.randomUUID().toString());
String ID=UUID.randomUUID().toString();
req.setId(ID);
BeanPlusUtil.copyProperties(req, supplier);
return this.save(supplier);
this.save(supplier);
return ID;
}
......
......@@ -29,28 +29,13 @@ import java.util.*;
@Slf4j
public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> implements WarehouseService {
@Resource
private RedisUtils redisUtils;
@Resource
private WarehouseMapper warehouseMapper;
@Resource
private PolicemanMapper policemanMapper;
@Resource
private PubOrgMapper pubOrgMapper;
@Resource
private ShelfMapper shelfMapper;
@Resource
private PubOrgService pubOrgService;
@Resource
private WarehouseAreaMapper areaMapper;
private static final String REDIS_WAREHOUSE = "Warehouse_";
@Override
......@@ -97,17 +82,6 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
}
public List<String> getSubIds(String id) {
List<String> subIds = new ArrayList<>();
subIds.add(id);
List<String> subMenus = policemanMapper.getChildren(id);//查询该id的子类id
if (subMenus != null) {
for (String subMenu : subMenus) {
subIds.addAll(getSubIds(subMenu));
}
}
return subIds;
}
@Override
public List<WarehouseDto> getAllWarehouse(WarehouseReq msg) {
......
......@@ -31,80 +31,7 @@
create_user, update_user
</sql>
<insert id="addCabinet" parameterType="com.junmp.jyzb.entity.Warehouse">
insert into base_cabinet
(id,cabinet_num,name,org_id,location,state,num,create_time,update_time)
values
(#{id},#{cabinetNum},#{name},#{orgId},#{location},1,#{num},#{createTime},#{updateTime})
</insert>
<select id="getOneCabinet" resultType="Map">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime
from base_cabinet c,pub_org o
where c.id=#{id} and c.org_id_int =o.org_id
</select>
<update id="updateCabinet">
update base_cabinet p
set cabinet_num = #{cabinetNum},name=#{name},location=#{location},update_time=#{updateTime},org_id_int=#{orgId}
where p.id =#{id}
</update>
<select id="getAllCabinet" resultMap="BaseCabinetResultMap" >
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime,
c.sum as sum,
c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
</select>
<select id="getAllCabinetId" resultType="String">
select id
from base_cabinet w
where org_id=#{orgId};
</select>
<update id="changeCabinetState">
update base_cabinet c
set state = #{state}
where c.id =#{id}
</update>
<select id="getAllCabinetBoxId" resultType="String">
select id
from base_cabinet_box b
where cabinet_id=#{id}
</select>
<select id="getAllCabinetIdByHighest" resultType="String">
select id
from base_cabinet w
</select>
<select id="getCabinetNumById" resultType="java.lang.String">
select cabinet_num from base_cabinet where id =#{id}
</select>
<select id="getAllCabinetByOrgList" parameterType="java.util.List" resultType="com.junmp.jyzb.entity.Cabinet">
select
......@@ -126,107 +53,6 @@
#{item}
</foreach>
</select>
<select id="getAllCabinetList" resultType="com.junmp.jyzb.entity.Cabinet">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime,
c.sum as sum,
c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
where c.org_id_int in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="setCabinetSumInventory">
UPDATE base_cabinet AS c
SET sum = (
SELECT count(i.id)
FROM base_cabinet_box AS b
JOIN base_AS i ON b.id = i.location_id
WHERE b.cabinet_id = c.id
)
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
<update id="setCabinetInSumInventory">
UPDATE base_cabinet AS c
JOIN (
SELECT b.cabinet_id, COUNT(i.id) AS total_count
FROM base_cabinet_box AS b
JOIN base_inventory AS i ON b.id = i.location_id
WHERE i.location_state = 'in'
GROUP BY b.cabinet_id
) AS subquery ON c.id = subquery.cabinet_id
SET c.in_sum = subquery.total_count
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
<update id="setCabinetOutSumInventory">
UPDATE base_cabinet AS c
SET out_sum = (
SELECT count(i.id)
FROM base_cabinet_box AS b
JOIN base_inventory AS i ON b.id = i.location_id
WHERE b.cabinet_id = c.id and i.location_state="out"
)
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
<update id="setCabinetPriceInventory">
UPDATE base_cabinet AS c
SET price_total = (
SELECT sum(price)
FROM base_cabinet_box AS b
JOIN base_inventory AS i ON b.id = i.location_id
WHERE b.cabinet_id = c.id
)
<if test="updateId != null and updateId != ''">
where c.id = #{updateId}
</if>
</update>
<select id="getOrgByCabinet" resultType="String">
select
o.org_id
from base_cabinet c
join pub_org o on c.org_id_int =o.org_id
where c.id = #{cabinetId}
</select>
<select id="getCabinetByOrgId" resultType="map">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime,
c.sum as sum,
c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
where c.org_id_int = #{orgId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.MsgMapper">
<select id="getMsg" resultType="Map">
<if test="tableName != null and tableName != ''">
<![CDATA[
select *
from ]]>
${tableName}
<![CDATA[
where org_id = #{orgId}
]]>
</if>
</select>
<select id="getUserMsg" resultType="Map">
select
suo.user_org_id as userOrgId,
suo.user_id as userId,
suo.org_id as orgId,
suo.position_id as positionId,
su.real_name as realName,
su.nick_name as nickName,
su.account as account,
su.password as password,
su.avatar as avatar,
su.birthday as birthday,
su.sex as sex,
su.email as email,
su.phone as phone,
su.tel as tel,
su.super_admin_flag as superAdminFlag,
su.status_flag as statusFlag,
su.user_type as userType,
su.last_login_ip as lastLoginIp,
su.last_login_time as lastLoginTime,
su.del_flag as delFlag,
su.create_time as createTime,
su.create_user as createUser,
su.update_time as updateTime,
su.update_user as updateUser,
su.app_flag as appFlag
from sys_user_org suo
join sys_user su on suo.user_id = su.user_id
where suo.org_id = #{orgId}
</select>
</mapper>
\ No newline at end of file
......@@ -8,23 +8,5 @@
id, police_id, finger_info, create_time, update_time
</sql>
<select id="getFingersByUserId" parameterType="String" resultType="java.util.Map">
SELECT f.id as fingerId,f.name,f.finger_info as fingerInfo
FROM base_police_finger f
WHERE f.police_id = #{userId}
</select>
<insert id="addFingers">
insert into base_police_finger
(police_id,name,finger_info,create_time,update_time)
VALUES
(#{policeId},#{name},#{fingerInfo},#{createTime},update_time)
</insert>
<update id="updateFingers">
update base_police_finger p
set name = #{name},finger_info=#{fingerInfo},update_time=#{updateTime}
where p.id =#{id}
</update>
</mapper>
\ No newline at end of file
......@@ -94,50 +94,6 @@
<!-- and delete_flag=0-->
<!-- </select>-->
<select id="getAllPoliceId" resultType="String">
select id
from base_policeman p
where org_id_int=#{orgId}
</select>
<select id="getAllPoliceIdByHighest" resultType="String">
select id
from base_policeman p
</select>
<delete id="deleteFinger">
delete from base_police_finger
where id =#{fingerId}
</delete>
<select id="getAllPoliceIdByBoxId" resultType="String">
select id
from base_policeman p
where cabinet_box_id=#{boxId}
</select>
<update id="addFaceInfo" parameterType="com.junmp.jyzb.entity.Policeman">
update base_policeman p
set face_info=#{faceInfo},update_time=#{updateTime}
where p.id=#{id}
</update>
<select id="getChildren" resultType="String">
select org_id from pub_org where org_parent_id = #{id}
</select>
<select id="getAllBoxIdByCabinet" resultType="String">
select id
from base_cabinet_box b
where cabinet_id=#{cabinetId}
</select>
<select id="getPoliceCodeById" resultType="java.lang.String">
select police_code from base_policeman where id =#{id}
</select>
<select id="getAllPolicemanByOrg" resultType="Map">
SELECT
p.id AS id,
......
......@@ -45,28 +45,6 @@ WHERE
del_flag = 1;
</select>
<select id="showAllPubOrgList" resultType="com.junmp.jyzb.entity.PubOrg">
SELECT org_id,
IFNULL(org_id, 'null') as orgId,
IFNULL(org_parent_id, 'null') as orgParentId,
IFNULL(org_name, 'null') as orgName,
IFNULL(d_name, 'null') as dName,
IFNULL(find_code, 'null') as findCode,
IFNULL(del_flag, 'null') as delFlag
FROM pub_org
</select>
<select id="getOnePubOrg" resultType="Long">
select org_id
from pub_org t
where t.org_id =#{orgId}
</select>
<update id="setMsg">
update pub_org
set d_name =#{orgName}
where org_id = #{id}
</update>
<update id="wipeParentIdsData">
UPDATE pub_org t
......@@ -119,12 +97,5 @@ SET p.org_parent_ids = cte.org_parent_ids;
select d_name from pub_org o where org_id =#{orgParentId}
</select>
<update id="changeOrgState">
UPDATE pub_org
SET status_flag = #{statusFlag}
WHERE org_id IN
<foreach item="item" collection="orgIdList" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>
\ No newline at end of file
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Zeppelin 忽略的文件
/ZeppelinRemoteNotebooks/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/resources.iml" filepath="$PROJECT_DIR$/.idea/resources.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../.." vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -13,7 +13,7 @@
<module>jyzb-api</module>
<module>jyzb-boot</module>
<module>jyzb-biz</module>
<!-- <module>jyzb-process</module>-->
<module>jyzb-process</module>
<module>jyzb-common</module>
<module>jyzb-mq</module>
</modules>
......@@ -110,13 +110,11 @@
<artifactId>v2-config-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-db-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-log-boot-starter</artifactId>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论