|
|
@@ -1,15 +1,21 @@
|
|
|
package org.jeecg.modules.hlgcompany.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.netty.util.internal.StringUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.StringUtils;
|
|
|
import org.jeecg.common.util.YouBianCodeUtil;
|
|
|
+import org.jeecg.common.utils.HttpsContants;
|
|
|
+import org.jeecg.common.utils.OauthApi;
|
|
|
+import org.jeecg.common.utils.OauthTokenUtils;
|
|
|
import org.jeecg.modules.hlgcompany.entity.HlgCompany;
|
|
|
import org.jeecg.modules.hlgcompany.mapper.HlgCompanyMapper;
|
|
|
import org.jeecg.modules.hlgcompany.mapper.HlgCompanySubcontractorMapper;
|
|
|
@@ -42,6 +48,7 @@ import java.util.*;
|
|
|
* @Date: 2020-02-17
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class HlgCompanyServiceImpl extends ServiceImpl<HlgCompanyMapper, HlgCompany> implements IHlgCompanyService {
|
|
|
@Autowired
|
|
|
@@ -101,6 +108,32 @@ public class HlgCompanyServiceImpl extends ServiceImpl<HlgCompanyMapper, HlgComp
|
|
|
hlgCompany.setUpdateBy(sysUser.getUsername());
|
|
|
hlgCompany.setSysOrgCode(sysDepart.getOrgCode());
|
|
|
this.save(hlgCompany);
|
|
|
+ //同步慧盈
|
|
|
+ String accessToken = OauthTokenUtils.getDayAccessToken();
|
|
|
+ String requestUrl = HttpsContants.OAUTH_PREFIX_URL + OauthApi.companyAdd;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ parameters.put("applicationId", 1);
|
|
|
+ parameters.put("companyCode", hlgCompany.getSysOrgCode());
|
|
|
+ parameters.put("companyName", hlgCompany.getCompanyName());
|
|
|
+ parameters.put("dutyParagraph", hlgCompany.getDutyParagraph());
|
|
|
+ parameters.put("businessLicense", hlgCompany.getBusinessLicense());
|
|
|
+ parameters.put("provinceCode", hlgCompany.getProvinceCode());
|
|
|
+ parameters.put("cityCode", hlgCompany.getCityCode());
|
|
|
+ parameters.put("countryCode", hlgCompany.getCountryCode());
|
|
|
+ parameters.put("provinceCityCountry", hlgCompany.getProvinceCityCountry());
|
|
|
+ log.info("param============{}", JSONObject.toJSONString(parameters));
|
|
|
+ JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, JSONObject.toJSONString(parameters), accessToken);
|
|
|
+ log.info("企业-新增===={}", jsonObject);
|
|
|
+ if (jsonObject != null) {
|
|
|
+ if (jsonObject.getBoolean("success")) {
|
|
|
+ log.info("企业-新增成功===={}", jsonObject);
|
|
|
+ } else {
|
|
|
+ //抛出异常,事务回滚
|
|
|
+ throw new JeecgBootException("添加失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("添加失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -259,8 +292,8 @@ public class HlgCompanyServiceImpl extends ServiceImpl<HlgCompanyMapper, HlgComp
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void removeCompanyByIds(String ids) {
|
|
|
- List<String> list=Arrays.asList(ids.split(","));
|
|
|
- for (int i = 0; i <list.size() ; i++) {
|
|
|
+ List<String> list = Arrays.asList(ids.split(","));
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
//获取当前企业的机构code
|
|
|
HlgCompany hlgCompany = getById(list.get(i));
|
|
|
//获取当前企业
|
|
|
@@ -304,9 +337,9 @@ public class HlgCompanyServiceImpl extends ServiceImpl<HlgCompanyMapper, HlgComp
|
|
|
public Result<HlgCompany> updateCompanyPay(HlgCompany hlgCompany) {
|
|
|
Result<HlgCompany> result = new Result<HlgCompany>();
|
|
|
//查询平台支付设置
|
|
|
- HlgCpSetting hlgCpSetting=hlgCpSettingService.findHlgCpSetting();
|
|
|
+ HlgCpSetting hlgCpSetting = hlgCpSettingService.findHlgCpSetting();
|
|
|
//查询企业对服务商税率(通过企业id和服务商id)
|
|
|
- Double serviceRate=hlgCompanySubcontractorMapper.findMaxServiceRateByCpCompanyIdAndSubcontractorId(hlgCpSetting.getCompanyId(),hlgCpSetting.getSubcontractorId());
|
|
|
+ Double serviceRate = hlgCompanySubcontractorMapper.findMaxServiceRateByCpCompanyIdAndSubcontractorId(hlgCpSetting.getCompanyId(), hlgCpSetting.getSubcontractorId());
|
|
|
BigDecimal data1 = BigDecimal.valueOf(serviceRate);
|
|
|
BigDecimal data2 = BigDecimal.valueOf(hlgCompany.getCpServiceRate());
|
|
|
//-1小于;0等于;1:大于
|
|
|
@@ -314,12 +347,12 @@ public class HlgCompanyServiceImpl extends ServiceImpl<HlgCompanyMapper, HlgComp
|
|
|
result.error500("服务费率要大于等于支付平台对真实服务商的服务费率");
|
|
|
return result;
|
|
|
}
|
|
|
- HlgCompany hlgCompanyEntity =getById(hlgCompany.getId());
|
|
|
- if(hlgCompanyEntity==null) {
|
|
|
+ HlgCompany hlgCompanyEntity = getById(hlgCompany.getId());
|
|
|
+ if (hlgCompanyEntity == null) {
|
|
|
result.error500("未找到对应实体");
|
|
|
- }else {
|
|
|
- if(StringUtils.isBlank(hlgCompanyEntity.getCpBankInfo())){
|
|
|
- HlgCpAccount hlgCpAccount=new HlgCpAccount();
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isBlank(hlgCompanyEntity.getCpBankInfo())) {
|
|
|
+ HlgCpAccount hlgCpAccount = new HlgCpAccount();
|
|
|
hlgCpAccount.setCpCompanyId(hlgCpSetting.getCompanyId());
|
|
|
hlgCpAccount.setCompanyId(hlgCompany.getId());
|
|
|
hlgCpAccount.setTotalDeposit(0.00);
|