|
|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.hlgsubcontractor.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -11,11 +12,15 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.hlgcompany.entity.HlgCompany;
|
|
|
import org.jeecg.modules.hlgcompany.entity.HlgCompanySubcontractor;
|
|
|
import org.jeecg.modules.hlgcompany.mapper.HlgCompanySubcontractorMapper;
|
|
|
+import org.jeecg.modules.hlgcompany.service.IHlgCompanyService;
|
|
|
import org.jeecg.modules.hlgcompany.service.IHlgCompanySubcontractorService;
|
|
|
import org.jeecg.modules.hlgsubcontractor.entity.HlgSubcontractorBankInformation;
|
|
|
|
|
|
@@ -56,6 +61,8 @@ public class HlgSubcontractorBankInformationController {
|
|
|
private IHlgCompanySubcontractorService hlgCompanySubcontractorService;
|
|
|
@Resource
|
|
|
private HlgCompanySubcontractorMapper hlgCompanySubcontractorMapper;
|
|
|
+ @Autowired
|
|
|
+ private IHlgCompanyService hlgCompanyService;
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
@@ -87,21 +94,42 @@ public class HlgSubcontractorBankInformationController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping(value = "/getSubcontractorBankInformation")
|
|
|
- public Result<List<HlgSubcontractorBankInformation>> getSubcontractorBankInformation(@RequestParam(name = "subcontractorId", required = true) String subcontractorId, @RequestParam(name = "companyId", required = true) String companyId) {
|
|
|
+ public Result<List<HlgSubcontractorBankInformation>> getSubcontractorBankInformation(@RequestParam(name = "subcontractorId", required = true) Integer subcontractorId, @RequestParam(name = "companyId", required = true) Integer companyId) {
|
|
|
Result<List<HlgSubcontractorBankInformation>> result = new Result<List<HlgSubcontractorBankInformation>>();
|
|
|
- //当前企业服务商
|
|
|
- QueryWrapper<HlgCompanySubcontractor> queryWrapperCom = new QueryWrapper<>();
|
|
|
- queryWrapperCom.eq("company_id", companyId);
|
|
|
- queryWrapperCom.eq("subcontractor_id", subcontractorId);
|
|
|
- HlgCompanySubcontractor hlgCompanySubcontractor = hlgCompanySubcontractorService.getOne(queryWrapperCom);
|
|
|
+ List<HlgSubcontractorBankInformation> list = new ArrayList<>();
|
|
|
+ /**
|
|
|
+ * 判断是否是平台服务商(A-B)
|
|
|
+ */
|
|
|
+ if (subcontractorId == 0) {
|
|
|
+ QueryWrapper<HlgCompany> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("id", companyId);
|
|
|
+ HlgCompany hlgCompany = hlgCompanyService.getOne(queryWrapper);
|
|
|
+ String cpBankInfo = hlgCompany.getCpBankInfo();
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(cpBankInfo);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ HlgSubcontractorBankInformation hlgSubcontractorBankInformation = new HlgSubcontractorBankInformation();
|
|
|
+ hlgSubcontractorBankInformation.setBankAccount(jsonObject.getString("bankAccount"));
|
|
|
+ hlgSubcontractorBankInformation.setBankAddress(jsonObject.getString("bankAddress"));
|
|
|
+ hlgSubcontractorBankInformation.setBankName(jsonObject.getString("bankName"));
|
|
|
+ list.add(hlgSubcontractorBankInformation);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //当前企业服务商
|
|
|
+ QueryWrapper<HlgCompanySubcontractor> queryWrapperCom = new QueryWrapper<>();
|
|
|
+ queryWrapperCom.eq("company_id", companyId);
|
|
|
+ queryWrapperCom.eq("subcontractor_id", subcontractorId);
|
|
|
+ HlgCompanySubcontractor hlgCompanySubcontractor = hlgCompanySubcontractorService.getOne(queryWrapperCom);
|
|
|
|
|
|
- String[] bankIds = hlgCompanySubcontractor.getBankIds().split(",");
|
|
|
+ String[] bankIds = hlgCompanySubcontractor.getBankIds().split(",");
|
|
|
+
|
|
|
+ //当前企业服务商选中的银行信息
|
|
|
+ QueryWrapper<HlgSubcontractorBankInformation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("subcontractor_id", subcontractorId);
|
|
|
+ queryWrapper.in("id", bankIds);
|
|
|
+ list = hlgSubcontractorBankInformationService.list(queryWrapper);
|
|
|
+ }
|
|
|
|
|
|
- //当前企业服务商选中的银行信息
|
|
|
- QueryWrapper<HlgSubcontractorBankInformation> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("subcontractor_id", subcontractorId);
|
|
|
- queryWrapper.in("id", bankIds);
|
|
|
- List<HlgSubcontractorBankInformation> list = hlgSubcontractorBankInformationService.list(queryWrapper);
|
|
|
if (list.size() <= 0) {
|
|
|
result.error500("未找到对应实体");
|
|
|
} else {
|
|
|
@@ -179,8 +207,8 @@ public class HlgSubcontractorBankInformationController {
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
try {
|
|
|
- int count =hlgCompanySubcontractorMapper.findCountByBankId(id);
|
|
|
- if(count>0){
|
|
|
+ int count = hlgCompanySubcontractorMapper.findCountByBankId(id);
|
|
|
+ if (count > 0) {
|
|
|
return Result.error("该打款信息正在被企业使用,无法删除!");
|
|
|
}
|
|
|
HlgSubcontractorBankInformation hlgSubcontractorBankInformation = hlgSubcontractorBankInformationService.getById(id);
|