Merge branch 'fencang' into busUser

# Conflicts:
#	api-admin/src/main/java/com/glxp/sale/admin/service/receipt/SyncUdiService.java
#	api-admin/src/main/resources/application-dev.properties
zhairh
anthonyywj2 3 years ago
commit 265dae837d

@ -1,5 +1,6 @@
package com.glxp.sale.admin.controller.basic;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.sale.admin.entity.receipt.ProductInfoEntity;
import com.glxp.sale.admin.entity.udid.UdiEntity;
@ -8,6 +9,7 @@ import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.res.inout.ProductInfoResponse;
import com.glxp.sale.admin.service.receipt.ProductInfoService;
import com.glxp.sale.admin.util.FilterUdiUtils;
import com.glxp.sale.admin.util.RedisUtil;
import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
import org.springframework.web.bind.annotation.GetMapping;
@ -24,7 +26,8 @@ import java.util.stream.Collectors;
public class ProductInfoController {
@Resource
ProductInfoService productInfoService;
@Resource
RedisUtil redisUtil;
//手持枪扫码查询
@GetMapping("udidl/device/findBydi")
@ -156,11 +159,22 @@ public class ProductInfoController {
}
productInfoFilterRequest.setIsNewest(1);
productInfoFilterRequest.setDiType("1");
List<ProductInfoEntity> productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest);
PageInfo<ProductInfoEntity> pageInfo;
pageInfo = new PageInfo<>(productInfoEntityList);
String keyCache = productInfoFilterRequest.toCacheKey();
if (StrUtil.isEmpty(keyCache)) {
return ResultVOUtils.error(500, "查询条件不能为空!");
}
String totalStr = (String) redisUtil.get(keyCache);
long total = 0;
if (StrUtil.isEmpty(totalStr)) {
total = productInfoService.filterUdiNoPageCount(productInfoFilterRequest);
} else {
total = Long.parseLong(totalStr);
}
List<ProductInfoEntity> productInfoEntityList = productInfoService.filterUdiNoPage(productInfoFilterRequest);
PageSimpleResponse<ProductInfoEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setTotal(total);
pageSimpleResponse.setList(productInfoEntityList);
return ResultVOUtils.success(pageSimpleResponse);

@ -86,7 +86,6 @@ public class UdiInfoController {
productInfoFilterRequest.setNameCode(nameCode);
try {
BaseResponse<PageSimpleResponse<ProductInfoEntity>> udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest);
if (udiDlDeviceResponse.getCode() != 20000) {
return udiDlDeviceResponse;
} else if (filterUdiInfoRequest.getIsCheck() != null && filterUdiInfoRequest.getIsCheck()) {

@ -43,6 +43,10 @@ public interface ProductInfoDao {
List<ProductInfoEntity> filterUdi(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> filterUdiNoPage(ProductInfoFilterRequest productInfoFilterRequest);
Long filterUdiNoPageCount(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> syncDlUdi(ProductInfoFilterRequest productInfoFilterRequest);
List<String> filterUuidByCreditNo(ProductInfoFilterRequest productInfoFilterRequest);

@ -20,4 +20,9 @@ public class ProductInfoFilterRequest extends ListPageRequest {
private Integer isNewest;
private String zczbhhzbapzbh;
private String updateTime;
public String toCacheKey() {
return nameCode + deviceRecordKey + uuid + cpmctymc + ylqxzcrbarmc + ggxh + tyshxydm + diType + zczbhhzbapzbh + updateTime;
}
}

@ -27,6 +27,10 @@ public interface ProductInfoService {
List<ProductInfoEntity> filterUdi(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> filterUdiNoPage(ProductInfoFilterRequest productInfoFilterRequest);
Long filterUdiNoPageCount(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> selectByUuid(String uuid);
List<ProductInfoEntity> syncDlUdi(ProductInfoFilterRequest productInfoFilterRequest);

@ -9,6 +9,7 @@ import com.glxp.sale.admin.req.basic.UdiCompanyRequest;
import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.service.basic.UdiCompanyService;
import com.glxp.sale.admin.util.RedisUtil;
import com.glxp.sale.common.enums.ResultEnum;
import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
@ -27,6 +28,8 @@ public class SyncUdiService {
ProductInfoService productInfoService;
@Resource
UdiCompanyService udiCompanyService;
@Resource
RedisUtil redisUtil;
public BaseResponse filterUdi(ProductInfoFilterRequest productInfoFilterRequest) {
@ -64,10 +67,12 @@ public class SyncUdiService {
return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称");
}
}
if (
StrUtil.isEmpty(productInfoFilterRequest.getYlqxzcrbarmc())
&& (productInfoFilterRequest.getNameCode() == null || productInfoFilterRequest.getNameCode().equals(""))
&& (productInfoFilterRequest.getCpmctymc() == null || productInfoFilterRequest.getCpmctymc().equals(""))
if ((productInfoFilterRequest.getYlqxzcrbarmc() == null || productInfoFilterRequest.getYlqxzcrbarmc().equals(""))
&& (productInfoFilterRequest.getNameCode() == null || productInfoFilterRequest.getNameCode().equals(""))
&& (productInfoFilterRequest.getCpmctymc() == null || productInfoFilterRequest.getCpmctymc().equals(""))
) {
if (productInfoFilterRequest.getGgxh() != null && !productInfoFilterRequest.getGgxh().equals("")) {
return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称");
@ -77,13 +82,28 @@ public class SyncUdiService {
}
}
if (productInfoFilterRequest.getCpmctymc() != null && !productInfoFilterRequest.getCpmctymc().equals("") && productInfoFilterRequest.getCpmctymc().length() < 4) {
return ResultVOUtils.error(500, "请输入完整的产品通用名称!");
}
productInfoFilterRequest.setIsNewest(1);
// productInfoFilterRequest.setDiType("1");
List<ProductInfoEntity> productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest);
PageInfo<ProductInfoEntity> pageInfo;
pageInfo = new PageInfo<>(productInfoEntityList);
productInfoFilterRequest.setDiType("1");
String keyCache = productInfoFilterRequest.toCacheKey();
if (StrUtil.isEmpty(keyCache)) {
return ResultVOUtils.error(500, "查询条件不能为空!");
}
String totalStr = (String) redisUtil.get(keyCache);
long total = 0;
if (StrUtil.isEmpty(totalStr)) {
total = productInfoService.filterUdiNoPageCount(productInfoFilterRequest);
redisUtil.set(keyCache, total + "");
} else {
total = Long.parseLong(totalStr);
}
List<ProductInfoEntity> productInfoEntityList = productInfoService.filterUdiNoPage(productInfoFilterRequest);
PageSimpleResponse<ProductInfoEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setTotal(total);
pageSimpleResponse.setList(productInfoEntityList);
return ResultVOUtils.success(pageSimpleResponse);

@ -5,6 +5,7 @@ import com.glxp.sale.admin.dao.basic.ProductInfoDao;
import com.glxp.sale.admin.entity.receipt.ProductInfoEntity;
import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest;
import com.glxp.sale.admin.service.receipt.ProductInfoService;
import com.glxp.sale.admin.util.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -98,6 +99,38 @@ public class ProductInfoServiceImpl implements ProductInfoService {
return null;
}
@Override
public List<ProductInfoEntity> filterUdiNoPage(ProductInfoFilterRequest productInfoFilterRequest) {
if (productInfoFilterRequest == null) {
return Collections.emptyList();
}
if (productInfoFilterRequest.getPage() != null) {
int offset = (productInfoFilterRequest.getPage() - 1) * productInfoFilterRequest.getLimit();
productInfoFilterRequest.setPage(offset);
productInfoFilterRequest.setLimit(productInfoFilterRequest.getLimit());
}
List<ProductInfoEntity> data = productInfoDao.filterUdiNoPage(productInfoFilterRequest);
return data;
}
@Override
public Long filterUdiNoPageCount(ProductInfoFilterRequest request) {
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
BeanUtils.copyProperties(request, productInfoFilterRequest);
if (productInfoFilterRequest.getPage() != null) {
int offset = (productInfoFilterRequest.getPage() - 1) * productInfoFilterRequest.getLimit();
productInfoFilterRequest.setPage(offset);
productInfoFilterRequest.setLimit(productInfoFilterRequest.getLimit());
}
return productInfoDao.filterUdiNoPageCount(productInfoFilterRequest);
}
@Override
public List<ProductInfoEntity> filterUdi(ProductInfoFilterRequest productInfoFilterRequest) {
if (productInfoFilterRequest == null) {
@ -121,10 +154,6 @@ public class ProductInfoServiceImpl implements ProductInfoService {
@Override
public List<ProductInfoEntity> syncDlUdi(ProductInfoFilterRequest productInfoFilterRequest) {
// if (productInfoFilterRequest.getPage() != null) {
// int offset = (productInfoFilterRequest.getPage() - 1) * productInfoFilterRequest.getLimit();
// PageHelper.offsetPage(offset, productInfoFilterRequest.getLimit());
// }
int offset = (productInfoFilterRequest.getPage() - 1) * productInfoFilterRequest.getLimit();
productInfoFilterRequest.setPage(offset);
productInfoFilterRequest.setLimit(productInfoFilterRequest.getLimit());

@ -1,6 +1,7 @@
package com.glxp.sale.admin.util;
import cn.hutool.core.collection.CollUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@ -11,11 +12,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* redisTemplate
*
* @author zjjlive@dist.com.cn
*/
@Component
public class RedisUtil {
@ -574,4 +570,12 @@ public class RedisUtil {
}
}
//模糊匹配删除
public void deleteByPrex(String prex) {
Set<String> keys = redisTemplate.keys(prex);
if (CollUtil.isNotEmpty(keys)) {
redisTemplate.delete(keys);
}
}
}

@ -259,8 +259,104 @@
</if>
</where>
</select>
<select id="filterUdiNoPage" parameterType="com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest"
resultType="com.glxp.sale.admin.entity.receipt.ProductInfoEntity">
select *
from productinfo
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc = #{ylqxzcrbarmc}
</if>
<if test="ylqxzcrbarmc == null and cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat(#{cpmctymc}, '%')
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null and cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode}, '%')
</if>
<if test="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="ggxh != '' and ggxh != null">
AND ggxh LIKE concat('%', #{ggxh}, '%')
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="deviceRecordKey != '' and deviceRecordKey != null">
AND deviceRecordKey = #{deviceRecordKey}
</if>
<if test="updateTime != null and updateTime != ''">
<![CDATA[
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="isNewest != null and isNewest != ''">
AND isNewest = #{isNewest}
</if>
<if test="diType != '' and diType != null">
AND diType = #{diType}
</if>
</where>
limit #{page},#{limit}
</select>
<select id="filterUdiNoPageCount" parameterType="com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest"
resultType="java.lang.Long">
select count(0)
from productinfo
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc = #{ylqxzcrbarmc}
</if>
<if test="ylqxzcrbarmc == null and cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat(#{cpmctymc}, '%')
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null and cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode}, '%')
</if>
<if test="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="ggxh != '' and ggxh != null">
AND ggxh LIKE concat('%', #{ggxh}, '%')
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="deviceRecordKey != '' and deviceRecordKey != null">
AND deviceRecordKey = #{deviceRecordKey}
</if>
<if test="updateTime != null and updateTime != ''">
<![CDATA[
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="isNewest != null and isNewest != ''">
AND isNewest = #{isNewest}
</if>
<if test="diType != '' and diType != null">
AND diType = #{diType}
</if>
</where>
</select>
<select id="selectByUpdateTime"
resultType="com.glxp.sale.admin.entity.receipt.ProductInfoEntity">
select *

Loading…
Cancel
Save