From 0cd3a666af34e28eaf50ed1392b5d219a9d2b1cf Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 24 七月 2024 09:42:06 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia
---
server/service/src/main/java/com/doumee/biz/system/impl/SystemDictDataBizImpl.java | 76 +++++++++++++++++++++++++++++++++-----
1 files changed, 66 insertions(+), 10 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/biz/system/impl/SystemDictDataBizImpl.java b/server/service/src/main/java/com/doumee/biz/system/impl/SystemDictDataBizImpl.java
index 0ebce2c..20de185 100644
--- a/server/service/src/main/java/com/doumee/biz/system/impl/SystemDictDataBizImpl.java
+++ b/server/service/src/main/java/com/doumee/biz/system/impl/SystemDictDataBizImpl.java
@@ -1,10 +1,14 @@
package com.doumee.biz.system.impl;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.HttpsUtil;
+import com.doumee.dao.business.vo.UnitCodeVo;
import com.doumee.dao.system.model.SystemDict;
import com.doumee.dao.system.model.SystemDictData;
import com.doumee.service.system.SystemDictDataService;
@@ -15,10 +19,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
@Service
public class SystemDictDataBizImpl implements SystemDictDataBiz {
@@ -33,11 +34,11 @@
public Integer create(SystemDictData systemDictData) {
SystemDictData queryDto = new SystemDictData();
queryDto.setDictId(systemDictData.getDictId());
- queryDto.setCode(systemDictData.getCode());
+ queryDto.setLabel(systemDictData.getLabel());
queryDto.setDeleted(Boolean.FALSE);
SystemDictData dictData = systemDictDataService.findOne(queryDto);
if (dictData != null) {
- throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "鏁版嵁鍊煎凡瀛樺湪");
+ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "鏁版嵁鏍囩宸插瓨鍦�");
}
return systemDictDataService.create(systemDictData);
}
@@ -46,19 +47,44 @@
public void updateById(SystemDictData systemDictData) {
SystemDictData queryDto = new SystemDictData();
queryDto.setDictId(systemDictData.getDictId());
- queryDto.setCode(systemDictData.getLabel());
+ queryDto.setLabel(systemDictData.getLabel());
queryDto.setDeleted(Boolean.FALSE);
SystemDictData dictData = systemDictDataService.findOne(queryDto);
if (dictData != null && !dictData.getId().equals(systemDictData.getId())) {
- throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "鏁版嵁鍊煎凡瀛樺湪");
+ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "鏁版嵁鏍囩宸插瓨鍦�");
}
systemDictDataService.updateById(systemDictData);
}
-
-
+ @Override
+ public String getUnitName(String unitCode, List<UnitCodeVo> unitCodeVoList) {
+ if(unitCodeVoList!=null){
+ for(UnitCodeVo c :unitCodeVoList){
+ if(StringUtils.equals(c.getCode(),unitCode)){
+ return c.getName();
+ }
+ }
+ }
+ return null;
+ }
@Override
public void updateByIdNew(SystemDictData systemDictData) {
systemDictDataService.updateById(systemDictData);
+ }
+ @Override
+ public List<UnitCodeVo> getUnitList(){
+ List<UnitCodeVo> list = new ArrayList<>();
+ try {
+ String temp = queryByCode(Constants.ZBOM,Constants.UNIT_CODE).getCode();
+ JSONArray array = JSONObject.parseArray(temp);
+ if(array!=null ){
+ for (int i = 0; i < array.size(); i++) {
+ list.add(JSONObject.toJavaObject(array.getJSONObject(i),UnitCodeVo.class));
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return list;
}
@Override
@@ -157,6 +183,36 @@
String targetPath = list.stream().filter(s -> s.getLabel().equals(targetCode)).findFirst().map(s -> s.getCode()).orElse("");
return resourcePath+targetPath;
}
+ @Override
+ public void updWxMiniToken() {
+ updWxMiniTokenDo(Constants.WX_APPID_CUSTOMER,Constants.WX_SECRET_CUSTOMER,Constants.WX_TOKEN_CUSTOMER);
+ updWxMiniTokenDo(Constants.WX_APPID_PERSONNEL,Constants.WX_SECRET_PERSONNEL,Constants.WX_TOKEN_PERSONNEL);
+
+ }
+ public void updWxMiniTokenDo(String appID,String appKey,String token) {
+ String appId = queryByCode(Constants.WX_MINI_CONFIG,appID).getCode();
+ String appSecret = queryByCode(Constants.WX_MINI_CONFIG,appKey).getCode();
+ //鐢熸垚寰俊token
+ String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+appSecret;
+ String response = HttpsUtil.sendGet(url);
+ JSONObject json = JSONObject.parseObject(response);
+ SystemDictData systemDictData = queryByCode(Constants.WX_MINI_CONFIG,token);
+ systemDictData.setCode(json.getString("access_token"));
+ systemDictData.setUpdateTime(new Date());
+ updateByIdNew(systemDictData);
+
+ appId = queryByCode(Constants.WX_MINI_CONFIG,Constants.WX_APPID_PERSONNEL).getCode();
+ appSecret = queryByCode(Constants.WX_MINI_CONFIG,Constants.WX_APPID_PERSONNEL).getCode();
+ //鐢熸垚寰俊token
+ url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+appSecret;
+ response = HttpsUtil.sendGet(url);
+ json = JSONObject.parseObject(response);
+ systemDictData = queryByCode(Constants.WX_MINI_CONFIG,Constants.WX_TOKEN_PERSONNEL);
+ systemDictData.setCode(json.getString("access_token"));
+ systemDictData.setUpdateTime(new Date());
+ updateByIdNew(systemDictData);
+
+ }
}
--
Gitblit v1.9.3