|
@@ -60,6 +60,9 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
@Value("${caimei.imageDomain}")
|
|
@Value("${caimei.imageDomain}")
|
|
private String imageDomain;
|
|
private String imageDomain;
|
|
|
|
|
|
|
|
+ @Value("${caimei.zpapi}")
|
|
|
|
+ private String zpServer;
|
|
|
|
+
|
|
private UploadService uploadService;
|
|
private UploadService uploadService;
|
|
|
|
|
|
@Value("${spring.profiles.active}")
|
|
@Value("${spring.profiles.active}")
|
|
@@ -146,13 +149,12 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
String productImage = productSaveDto.getProductImage();
|
|
String productImage = productSaveDto.getProductImage();
|
|
String snCode = productSaveDto.getSnCode();
|
|
String snCode = productSaveDto.getSnCode();
|
|
String certificateImage = productSaveDto.getCertificateImage();
|
|
String certificateImage = productSaveDto.getCertificateImage();
|
|
- String authImageLogo=productSaveDto.getAuthImageLogo();
|
|
|
|
|
|
+ String authImageLogo = productSaveDto.getAuthImageLogo();
|
|
Integer certificateImageType = productSaveDto.getCertificateImageType();
|
|
Integer certificateImageType = productSaveDto.getCertificateImageType();
|
|
Integer createBy = productSaveDto.getCreateBy();
|
|
Integer createBy = productSaveDto.getCreateBy();
|
|
String purchaseWay = productSaveDto.getPurchaseWay();
|
|
String purchaseWay = productSaveDto.getPurchaseWay();
|
|
String invoiceImage = productSaveDto.getInvoiceImage();
|
|
String invoiceImage = productSaveDto.getInvoiceImage();
|
|
Integer source = null == productSaveDto.getSource() ? 1 : productSaveDto.getSource();
|
|
Integer source = null == productSaveDto.getSource() ? 1 : productSaveDto.getSource();
|
|
- List<String> snList=productSaveDto.getSnList();
|
|
|
|
List<ProductParamPo> paramList = productSaveDto.getParamList();
|
|
List<ProductParamPo> paramList = productSaveDto.getParamList();
|
|
if (null == authId) {
|
|
if (null == authId) {
|
|
return ResponseJson.error("参数异常,请输入授权id", null);
|
|
return ResponseJson.error("参数异常,请输入授权id", null);
|
|
@@ -204,7 +206,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
if (null != productIdBySnCode) {
|
|
if (null != productIdBySnCode) {
|
|
return ResponseJson.error("该商品SN码已存在,请重新输入", null);
|
|
return ResponseJson.error("该商品SN码已存在,请重新输入", null);
|
|
}
|
|
}
|
|
- } else if (2 == authType){
|
|
|
|
|
|
+ } else if (2 == authType) {
|
|
// 关联设备
|
|
// 关联设备
|
|
productId = productIdBySnCode;
|
|
productId = productIdBySnCode;
|
|
// 检测机构是否已关联该设备
|
|
// 检测机构是否已关联该设备
|
|
@@ -213,7 +215,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
return ResponseJson.error("不能重复关联同一台设备");
|
|
return ResponseJson.error("不能重复关联同一台设备");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
// 编辑
|
|
// 编辑
|
|
dbRelation = authProductMapper.getProductRelation(relationId, null, null);
|
|
dbRelation = authProductMapper.getProductRelation(relationId, null, null);
|
|
dbProduct = authProductMapper.getProductFormData(relationId);
|
|
dbProduct = authProductMapper.getProductFormData(relationId);
|
|
@@ -226,7 +228,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
if (null != productIdBySnCode && !productIdBySnCode.equals(productId)) {
|
|
if (null != productIdBySnCode && !productIdBySnCode.equals(productId)) {
|
|
return ResponseJson.error("该商品SN码已存在,请重新输入", null);
|
|
return ResponseJson.error("该商品SN码已存在,请重新输入", null);
|
|
}
|
|
}
|
|
- } else if (2 == authType){
|
|
|
|
|
|
+ } else if (2 == authType) {
|
|
productId = productIdBySnCode;
|
|
productId = productIdBySnCode;
|
|
// 检测机构是否已关联该设备
|
|
// 检测机构是否已关联该设备
|
|
ProductRelationVo productRelation = authProductMapper.getProductRelation(null, productId, authId);
|
|
ProductRelationVo productRelation = authProductMapper.getProductRelation(null, productId, authId);
|
|
@@ -234,7 +236,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
return ResponseJson.error("不能重复关联同一台设备");
|
|
return ResponseJson.error("不能重复关联同一台设备");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else if (2 == dbRelation.getAuthType()){
|
|
|
|
|
|
+ } else if (2 == dbRelation.getAuthType()) {
|
|
// 原本为关联设备
|
|
// 原本为关联设备
|
|
if (1 == authType) {
|
|
if (1 == authType) {
|
|
// 设备id为null
|
|
// 设备id为null
|
|
@@ -314,9 +316,9 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
authProductMapper.updateProductByProductId(product);
|
|
authProductMapper.updateProductByProductId(product);
|
|
}
|
|
}
|
|
// 插入机构设备关联关系
|
|
// 插入机构设备关联关系
|
|
- authProductMapper.insertProductRelation(authId, product.getProductId(), authType);
|
|
|
|
|
|
+ authProductMapper.insertProductRelation(authId, product.getProductId(), authType);
|
|
//查询最新关联id
|
|
//查询最新关联id
|
|
- relationId=authProductMapper.getNewestRelationId();
|
|
|
|
|
|
+ relationId = authProductMapper.getNewestRelationId();
|
|
} else {
|
|
} else {
|
|
if (1 == dbRelation.getAuthType()) {
|
|
if (1 == dbRelation.getAuthType()) {
|
|
// 更新设备
|
|
// 更新设备
|
|
@@ -377,37 +379,38 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
}
|
|
}
|
|
return ResponseJson.success("保存授权商品成功");
|
|
return ResponseJson.success("保存授权商品成功");
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public ResponseJson saveProductAndRelaTion(Integer authId,List<String> snlist,Integer authType) throws IOException{
|
|
|
|
|
|
+ public ResponseJson saveProductAndRelaTion(Integer authId, List<String> snlist, Integer authType) throws IOException {
|
|
//判断机构关联id是否有值(有则机构关联关联了其他机构属于新增操作,无则属于编辑操作)
|
|
//判断机构关联id是否有值(有则机构关联关联了其他机构属于新增操作,无则属于编辑操作)
|
|
String relaId = authProductMapper.getRelationId(authId);
|
|
String relaId = authProductMapper.getRelationId(authId);
|
|
- List<Integer> listSnId=new ArrayList<>();
|
|
|
|
- if(null!=relaId&&!"".equals(relaId)){
|
|
|
|
|
|
+ List<Integer> listSnId = new ArrayList<>();
|
|
|
|
+ if (null != relaId && !"".equals(relaId)) {
|
|
//根据sn码获取产品id
|
|
//根据sn码获取产品id
|
|
- for(int i=0;i<snlist.size();i++){
|
|
|
|
|
|
+ for (int i = 0; i < snlist.size(); i++) {
|
|
List<ProductPo> List = authProductMapper.getSnList(snlist.get(i));
|
|
List<ProductPo> List = authProductMapper.getSnList(snlist.get(i));
|
|
//判断本身机构下的设备和关联机构下 设备有不有重复的
|
|
//判断本身机构下的设备和关联机构下 设备有不有重复的
|
|
- if(List.get(0).getAuthId()!=authId){
|
|
|
|
|
|
+ if (!List.get(0).getAuthId().equals(authId)) {
|
|
listSnId.add(List.get(0).getProductId());
|
|
listSnId.add(List.get(0).getProductId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//根据产品id插入机构设备关联关系
|
|
//根据产品id插入机构设备关联关系
|
|
- for(int i=0;i<snlist.size();i++){
|
|
|
|
|
|
+ for (int i = 0; i < snlist.size(); i++) {
|
|
authProductMapper.insertProductRelation(authId, listSnId.get(i), authType);
|
|
authProductMapper.insertProductRelation(authId, listSnId.get(i), authType);
|
|
}
|
|
}
|
|
return ResponseJson.success("保存授权商品成功");
|
|
return ResponseJson.success("保存授权商品成功");
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
//根据sn码获取产品id
|
|
//根据sn码获取产品id
|
|
- for(int i=0;i<snlist.size();i++){
|
|
|
|
|
|
+ for (int i = 0; i < snlist.size(); i++) {
|
|
List<ProductPo> List = authProductMapper.getSnList(snlist.get(i));
|
|
List<ProductPo> List = authProductMapper.getSnList(snlist.get(i));
|
|
//判断本身机构下的设备和关联机构下 设备有不有重复的
|
|
//判断本身机构下的设备和关联机构下 设备有不有重复的
|
|
- if(List.get(0).getAuthId()!=authId){
|
|
|
|
|
|
+ if (!List.get(0).getAuthId().equals(authId)) {
|
|
listSnId.add(List.get(0).getProductId());
|
|
listSnId.add(List.get(0).getProductId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//根据产品id插入机构设备关联关系
|
|
//根据产品id插入机构设备关联关系
|
|
- for(int i=0;i<snlist.size();i++){
|
|
|
|
|
|
+ for (int i = 0; i < snlist.size(); i++) {
|
|
authProductMapper.insertProductRelation(authId, listSnId.get(i), authType);
|
|
authProductMapper.insertProductRelation(authId, listSnId.get(i), authType);
|
|
}
|
|
}
|
|
return ResponseJson.success("保存授权商品成功");
|
|
return ResponseJson.success("保存授权商品成功");
|
|
@@ -440,6 +443,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
+
|
|
public String generateAuthImageLogo(TemplateVo authTemplate, ProductFormVo product) {
|
|
public String generateAuthImageLogo(TemplateVo authTemplate, ProductFormVo product) {
|
|
if (null != authTemplate) {
|
|
if (null != authTemplate) {
|
|
// 根据模板id设置相关数据
|
|
// 根据模板id设置相关数据
|
|
@@ -467,7 +471,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- private Map<String,Object> getTemplateInfo(TemplateVo template, ProductFormVo product) {
|
|
|
|
|
|
+ private Map<String, Object> getTemplateInfo(TemplateVo template, ProductFormVo product) {
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
Integer templateId = template.getTemplateId();
|
|
Integer templateId = template.getTemplateId();
|
|
if (1 == templateId) {
|
|
if (1 == templateId) {
|
|
@@ -514,7 +518,8 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
}
|
|
}
|
|
// 添加二维码信息
|
|
// 添加二维码信息
|
|
if (StringUtils.isNotEmpty(template.getQrPosition())) {
|
|
if (StringUtils.isNotEmpty(template.getQrPosition())) {
|
|
- String qrCodeLink = wwwServer + "/product/auth/product-" + product.getProductId() + ".html";
|
|
|
|
|
|
+ String authUserId = authMapper.getauthUserId(product.getAuthId());
|
|
|
|
+ String qrCodeLink = zpServer + "/" + authUserId + "/" + authMapper.getPrefix(Integer.valueOf(authUserId)) + "/approve/device/detail?id=" + product.getProductId();
|
|
map.put("addQr1_link", qrCodeLink);
|
|
map.put("addQr1_link", qrCodeLink);
|
|
map.put("addQr1_size", template.getQrSize());
|
|
map.put("addQr1_size", template.getQrSize());
|
|
String[] split = template.getQrPosition().split(",");
|
|
String[] split = template.getQrPosition().split(",");
|
|
@@ -527,7 +532,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
- private Map<String,Object> getTemplateLogoInfo(TemplateVo template, ProductFormVo product) {
|
|
|
|
|
|
+ private Map<String, Object> getTemplateLogoInfo(TemplateVo template, ProductFormVo product) {
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
Integer templateId = template.getTemplateId();
|
|
Integer templateId = template.getTemplateId();
|
|
if (1 == templateId) {
|
|
if (1 == templateId) {
|
|
@@ -591,7 +596,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
- private String addWaterMark(String image,Integer type) throws IOException {
|
|
|
|
|
|
+ private String addWaterMark(String image, Integer type) throws IOException {
|
|
//type:1pc,2applets
|
|
//type:1pc,2applets
|
|
ClassPathResource classPathResource = new ClassPathResource("/images/newPcWaterMark.png");
|
|
ClassPathResource classPathResource = new ClassPathResource("/images/newPcWaterMark.png");
|
|
InputStream inputStreamImg = classPathResource.getInputStream();
|
|
InputStream inputStreamImg = classPathResource.getInputStream();
|
|
@@ -640,8 +645,8 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
paramList = authProductMapper.getParamsByProductId(productForm.getProductId());
|
|
paramList = authProductMapper.getParamsByProductId(productForm.getProductId());
|
|
}
|
|
}
|
|
productForm.setParamList(paramList);
|
|
productForm.setParamList(paramList);
|
|
- if(null!=productForm){
|
|
|
|
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
+ if (null != productForm) {
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
String authDate = simpleDateFormat.format(productForm.getAuthDates());
|
|
String authDate = simpleDateFormat.format(productForm.getAuthDates());
|
|
productForm.setAuthDate(authDate);
|
|
productForm.setAuthDate(authDate);
|
|
}
|
|
}
|
|
@@ -656,7 +661,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
@Override
|
|
@Override
|
|
public ResponseJson updateAllWaterMark() {
|
|
public ResponseJson updateAllWaterMark() {
|
|
List<ProductPo> productList = authProductMapper.getAllImage();
|
|
List<ProductPo> productList = authProductMapper.getAllImage();
|
|
- productList.forEach(product->{
|
|
|
|
|
|
+ productList.forEach(product -> {
|
|
try {
|
|
try {
|
|
if (StringUtils.isNotEmpty(product.getImage())) {
|
|
if (StringUtils.isNotEmpty(product.getImage())) {
|
|
//商品图片添加水印
|
|
//商品图片添加水印
|
|
@@ -770,7 +775,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
}
|
|
}
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
List<WxProductListVo> productList = authProductMapper.getWxProductList(listType, authId, authParty, productTypeId, snCode);
|
|
List<WxProductListVo> productList = authProductMapper.getWxProductList(listType, authId, authParty, productTypeId, snCode);
|
|
- productList.forEach(product->{
|
|
|
|
|
|
+ productList.forEach(product -> {
|
|
List<WxClubListVo> clubList = authProductMapper.getProductClubList(product.getProductId());
|
|
List<WxClubListVo> clubList = authProductMapper.getProductClubList(product.getProductId());
|
|
product.setClubList(clubList);
|
|
product.setClubList(clubList);
|
|
});
|
|
});
|
|
@@ -833,8 +838,8 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
// 创建时间
|
|
// 创建时间
|
|
productType.setCreateTime(new Date());
|
|
productType.setCreateTime(new Date());
|
|
// 设备分类图片添加水印
|
|
// 设备分类图片添加水印
|
|
- productType.setPcImage(addWaterMark(productType.getImage(),1));
|
|
|
|
- productType.setAppletsImage(addWaterMark(productType.getImage(),2));
|
|
|
|
|
|
+ productType.setPcImage(addWaterMark(productType.getImage(), 1));
|
|
|
|
+ productType.setAppletsImage(addWaterMark(productType.getImage(), 2));
|
|
// 插入设备分类
|
|
// 插入设备分类
|
|
authProductMapper.insertProductType(productType);
|
|
authProductMapper.insertProductType(productType);
|
|
} else {
|
|
} else {
|
|
@@ -892,16 +897,16 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
List<ProductTypeListVo> productList = authProductMapper.getProductTypeList(listType, authUserId, name, status, auditStatus);
|
|
List<ProductTypeListVo> productList = authProductMapper.getProductTypeList(listType, authUserId, name, status, auditStatus);
|
|
//如果是手机号则进行脱敏处理
|
|
//如果是手机号则进行脱敏处理
|
|
//手机号脱敏处理(脱敏规则: 保留前三后四, 比如15638296218置换为156****6218)
|
|
//手机号脱敏处理(脱敏规则: 保留前三后四, 比如15638296218置换为156****6218)
|
|
- if(null!=productList&&productList.size()>0){
|
|
|
|
|
|
+ if (null != productList && productList.size() > 0) {
|
|
productList.forEach(authVo -> {
|
|
productList.forEach(authVo -> {
|
|
//判断是否是手机号
|
|
//判断是否是手机号
|
|
- String phoneNumber=authVo.getCreateBy();
|
|
|
|
- if(StringUtils.isNotEmpty(phoneNumber)){
|
|
|
|
|
|
+ String phoneNumber = authVo.getCreateBy();
|
|
|
|
+ if (StringUtils.isNotEmpty(phoneNumber)) {
|
|
// boolean matches = phoneNumber.matches("^[1][3,4,5,7,8,9][0-9]{9}$");
|
|
// boolean matches = phoneNumber.matches("^[1][3,4,5,7,8,9][0-9]{9}$");
|
|
// if(matches){
|
|
// if(matches){
|
|
- //脱敏处理
|
|
|
|
- phoneNumber = phoneNumber.replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2");
|
|
|
|
- authVo.setCreateBy(phoneNumber);
|
|
|
|
|
|
+ //脱敏处理
|
|
|
|
+ phoneNumber = phoneNumber.replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2");
|
|
|
|
+ authVo.setCreateBy(phoneNumber);
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -954,7 +959,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseJson<ProductFormVo> getProductInfo(Integer productId, String snCode) {
|
|
public ResponseJson<ProductFormVo> getProductInfo(Integer productId, String snCode) {
|
|
- ProductFormVo product = authProductMapper.getProductInfo(productId, snCode);
|
|
|
|
|
|
+ ProductFormVo product = authProductMapper.getProductInfo(productId, snCode);
|
|
if (null == product) {
|
|
if (null == product) {
|
|
return ResponseJson.error(-1, "设备SN码不存在", null);
|
|
return ResponseJson.error(-1, "设备SN码不存在", null);
|
|
}
|
|
}
|
|
@@ -972,7 +977,7 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
//获取该机构下所有的sn码
|
|
//获取该机构下所有的sn码
|
|
List<Integer> liallSn = authProductMapper.getAllSn(authId);
|
|
List<Integer> liallSn = authProductMapper.getAllSn(authId);
|
|
List<String> allSnlist = authProductMapper.getAllSnlist(liallSn);
|
|
List<String> allSnlist = authProductMapper.getAllSnlist(liallSn);
|
|
- List<String> snCodeList = authProductMapper.getSnCodeList(authUserId, authId,allSnlist);
|
|
|
|
|
|
+ List<String> snCodeList = authProductMapper.getSnCodeList(authUserId, authId, allSnlist);
|
|
return ResponseJson.success(snCodeList);
|
|
return ResponseJson.success(snCodeList);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -980,14 +985,14 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
public ResponseJson<List<String>> getSnCodeList1(Integer authUserId, Integer authId) {
|
|
public ResponseJson<List<String>> getSnCodeList1(Integer authUserId, Integer authId) {
|
|
//判断该机构是否与其他机构关联
|
|
//判断该机构是否与其他机构关联
|
|
String relationId = authProductMapper.getRelationId(authId);
|
|
String relationId = authProductMapper.getRelationId(authId);
|
|
- String[] relationIdList=null;
|
|
|
|
- List<String> snCodeList=new ArrayList<>();
|
|
|
|
- if (!"".equals(relationId)&&null !=relationId){
|
|
|
|
|
|
+ String[] relationIdList = null;
|
|
|
|
+ List<String> snCodeList = new ArrayList<>();
|
|
|
|
+ if (!"".equals(relationId) && null != relationId) {
|
|
relationIdList = relationId.split(",");
|
|
relationIdList = relationId.split(",");
|
|
//获取该机构下所有的sn码
|
|
//获取该机构下所有的sn码
|
|
List<Integer> liallSn = authProductMapper.getAllSn(authId);
|
|
List<Integer> liallSn = authProductMapper.getAllSn(authId);
|
|
List<String> allSnlist = authProductMapper.getAllSnlist(liallSn);
|
|
List<String> allSnlist = authProductMapper.getAllSnlist(liallSn);
|
|
- snCodeList = authProductMapper.getSnCodeList1(authUserId, authId,relationIdList,allSnlist);
|
|
|
|
|
|
+ snCodeList = authProductMapper.getSnCodeList1(authUserId, authId, relationIdList, allSnlist);
|
|
}
|
|
}
|
|
return ResponseJson.success(snCodeList);
|
|
return ResponseJson.success(snCodeList);
|
|
|
|
|
|
@@ -999,7 +1004,8 @@ public class AuthProductServiceImpl implements AuthProductService {
|
|
return ResponseJson.success();
|
|
return ResponseJson.success();
|
|
}
|
|
}
|
|
|
|
|
|
- public ResponseJson<List<ProductListVo>> getPronductInfo( Integer authId,Integer authUserId){
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<List<ProductListVo>> getPronductInfo(Integer authId, Integer authUserId) {
|
|
List<ProductListVo> pronductInfo = authProductMapper.getPronductInfo(authId, authUserId);
|
|
List<ProductListVo> pronductInfo = authProductMapper.getPronductInfo(authId, authUserId);
|
|
return ResponseJson.success(pronductInfo);
|
|
return ResponseJson.success(pronductInfo);
|
|
}
|
|
}
|