Commit d4e86830 authored by tangfang's avatar tangfang

修改余额为0的处理,

添加银行卡空指针问题
parent d6e7d25c
......@@ -47,6 +47,11 @@
<groupId>com.pangding.web</groupId>
<artifactId>pd-partner-ref</artifactId>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.33</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -5,6 +5,9 @@ import com.pangding.web.vo.system.req.AgreementTemplateReqVo;
import com.pangding.web.vo.system.res.AgreementTemplateResVo;
import com.yanzuoguang.util.helper.CheckerHelper;
import com.yanzuoguang.util.vo.ResponseResult;
import freemarker.cache.ClassTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -14,6 +17,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.StandardProtocolFamily;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
/**
* @author tangfang
* @date 2020-08-31 19:03:23
......@@ -63,4 +74,27 @@ public class AgreementController {
return ResponseResult.result("");
}
@RequestMapping(value = "/test")
@ApiOperation(value = "测试", notes = "返回删除结果")
public ResponseResult test(@RequestBody AgreementTemplateReqVo req, HttpServletResponse response) {
try{
response.setContentType("application/msword");
response.setCharacterEncoding("utf-8");
String filename = URLEncoder.encode("测试word","utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + filename + ".doc");
Configuration configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
configuration.setDefaultEncoding("utf-8");
configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), "templates"));
Template t = configuration.getTemplate("test.xml", "utf-8");
Writer out = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8), 10240);
t.process("", out);
out.close();
}catch (Exception e){
throw new RuntimeException();
}
return ResponseResult.result("");
}
}
......@@ -4,6 +4,7 @@ package com.pangding.web.authority.controller.company;
import com.pangding.web.authority.service.CompanyAgreementService;
import com.pangding.web.authority.service.CompanyService;
import com.pangding.web.authority.service.company.NewCompanyService;
import com.pangding.web.vo.system.pd.company.CompanyAgreementVo;
import com.pangding.web.vo.system.pd.company.CompanyVo;
import com.pangding.web.vo.system.req.company.CompanyAgreementReqVo;
import com.pangding.web.vo.system.req.company.CompanyReqVo;
......@@ -11,6 +12,7 @@ import com.pangding.web.vo.system.req.company.SaveCompanyReqVo;
import com.pangding.web.vo.system.res.company.CompanyPageResVo;
import com.pangding.web.vo.system.res.company.CompanyResVo;
import com.yanzuoguang.util.helper.CheckerHelper;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -62,6 +64,12 @@ public class CompanyController {
return companyService.updateCompanyInfo(req);
}
// @RequestMapping(value = "/examineCompany", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
// @ApiOperation(value = "审核配置公司信息", notes = "返回审核配置的结果")
// public ResponseResult<SaveCompanyReqVo> examineCompany(@RequestBody SaveCompanyReqVo req) {
// CheckerHelper.newInstance().notBlankCheck("id", req.getCompanyVo().getId()).checkException();
// return companyService.updateCompanyInfo(req);
// }
/**
* 找到公司余额
......@@ -79,16 +87,24 @@ public class CompanyController {
@ApiOperation(value = "查询公司是否已签署某合同", notes = "返回合同信息")
public ResponseResult checkAgreement(@RequestBody CompanyAgreementReqVo req) {
CheckerHelper.newInstance().notBlankCheck("companyId", req.getCompanyId())
.notBlankCheck("agreementCode", req.getAgreementCode())
// .notBlankCheck("agreementCode", req.getAgreementCode())
.checkException();
return ResponseResult.resultAllowNull(companyAgreementService.checkAgreement(req));
}
@RequestMapping(value = "/findCompanyAgreement")
@ApiOperation(value = "查询公司签署的合同", notes = "返回合同信息")
public ResponseResult<PageSizeData<CompanyAgreementVo>> findCompanyAgreement(@RequestBody CompanyAgreementReqVo req) {
CheckerHelper.newInstance().notBlankCheck("companyId", req.getCompanyId())
.checkException();
return ResponseResult.result(companyAgreementService.findCompanyAgreement(req));
}
@RequestMapping(value = "saveComapnyAgreement")
@ApiOperation(value = "公司签署合同", notes = "返回签署结果")
public ResponseResult saveCompanyAgreement(@RequestBody CompanyAgreementReqVo req){
CheckerHelper.newInstance().notBlankCheck("companyId", req.getCompanyId())
.notBlankCheck("agreementId", req.getAgreementId())
// .notBlankCheck("agreementId", req.getAgreementId())
.notBlankCheck("agreementCode", req.getAgreementCode())
.checkException();
return ResponseResult.result(companyAgreementService.saveCompanyAgreement(req));
......
package com.pangding.web.authority.dao;
import com.pangding.web.vo.system.pd.company.CompanyAgreementVo;
import com.pangding.web.vo.system.req.company.CompanyAgreementReqVo;
import com.yanzuoguang.dao.BaseDao;
import com.yanzuoguang.util.vo.PageSizeData;
public interface CompanyAgreementDao extends BaseDao {
PageSizeData<CompanyAgreementVo> findCompanyAgreement(CompanyAgreementReqVo reqVo);
}
......@@ -40,9 +40,10 @@ public class CapitalFlowDaoImpl extends BaseDaoImpl implements CapitalFlowDao {
table.add(QUERY_LIST_TOTAL, "SELECT SUM(CASE WHEN category = 0 THEN order_money ELSE 0 END) AS orderMoney," +
"SUM(CASE WHEN category = 0 THEN order_fee ELSE 0 END) AS orderFee," +
"SUM(CASE WHEN category = 0 THEN actual_money ELSE 0 END) AS realMoney," +
"SUM(CASE WHEN category = 1 THEN order_money ELSE 0 END) AS withdrawalAmount," +
"SUM(CASE WHEN category = 1 and `status` = 1 THEN order_money ELSE 0 END) AS withdrawalAmount," +
"SUM(CASE WHEN category = 3 THEN actual_money ELSE 0 END) AS refundMoney," +
"SUM(CASE WHEN category <> 3 THEN actual_money ELSE 0 END) - SUM(CASE WHEN category = 1 THEN order_money ELSE 0 END) as actualMoney" +
"SUM(CASE WHEN category <> 3 THEN actual_money ELSE 0 END) - " +
"SUM(CASE WHEN category = 1 and `status` = 1 THEN order_money ELSE 0 END) as actualMoney" +
" FROM pd_capital_flow where 1=1 {WHERE} GROUP BY 1{GROUP} order by time desc")
.addPara("companyGroup", "{GROUP}", ",company_id")
......
......@@ -2,15 +2,35 @@ package com.pangding.web.authority.dao.impl;
import com.pangding.web.authority.dao.CompanyAgreementDao;
import com.pangding.web.vo.system.pd.company.CompanyAgreementVo;
import com.pangding.web.vo.system.req.company.CompanyAgreementReqVo;
import com.pangding.web.vo.system.req.company.CompanyReqVo;
import com.pangding.web.vo.system.res.company.CompanyResVo;
import com.yanzuoguang.dao.impl.BaseDaoImpl;
import com.yanzuoguang.util.vo.PageSizeData;
import org.springframework.stereotype.Component;
@Component
public class CompanyAgreementDaoImpl extends BaseDaoImpl implements CompanyAgreementDao {
private static final String QUERY_LIST = "QUERY_LIST";
@Override
protected void init() {
register(CompanyAgreementVo.class);
table.add(QUERY_LIST,"select * " +
" from pd_company_agreement " +
"where 1=1 {WHERE} order by create_time desc")
.add("companyId"," and company_id = ? ");
}
@Override
public PageSizeData<CompanyAgreementVo> findCompanyAgreement(CompanyAgreementReqVo reqVo) {
return this.queryPage(CompanyAgreementVo.class,reqVo,QUERY_LIST,reqVo);
}
}
......@@ -3,6 +3,7 @@ package com.pangding.web.authority.service;
import com.pangding.web.vo.system.pd.company.CompanyAgreementVo;
import com.pangding.web.vo.system.req.company.CompanyAgreementReqVo;
import com.pangding.web.vo.system.res.company.CompanyAgreementResVo;
import com.yanzuoguang.util.vo.PageSizeData;
public interface CompanyAgreementService {
......@@ -10,4 +11,6 @@ public interface CompanyAgreementService {
CompanyAgreementVo saveCompanyAgreement(CompanyAgreementReqVo req);
PageSizeData<CompanyAgreementVo> findCompanyAgreement(CompanyAgreementReqVo req);
}
......@@ -37,6 +37,8 @@ public class AgreementServiceImpl implements AgreementService {
// 保存
ObjectHelper.writeWithFrom(agreementTemplateVo, req);
agreementTemplateVo.setCreateTime(DateHelper.getNow());
agreementTemplateVo.setAgreementId(StringHelper.getNewID());
agreementTemplateVo.setAgreementCode(agreementTemplateVo.getAgreementId());
agreementTemplateDao.create(agreementTemplateVo);
}else{
// 修改
......
package com.pangding.web.authority.service.impl;
import com.pangding.web.authority.dao.CompanyAgreementDao;
import com.pangding.web.authority.dao.company.CompanyDao;
import com.pangding.web.authority.dao.company.CompanyExtendDao;
import com.pangding.web.authority.service.CompanyAgreementService;
import com.pangding.web.vo.system.pd.company.CompanyAgreementVo;
import com.pangding.web.vo.system.pd.company.CompanyExtendVo;
import com.pangding.web.vo.system.pd.company.CompanyVo;
import com.pangding.web.vo.system.req.company.CompanyAgreementReqVo;
import com.pangding.web.vo.system.res.company.CompanyAgreementResVo;
import com.pangding.web.vo.system.res.company.CompanyResVo;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.StringHelper;
import org.springframework.beans.factory.annotation.Autowired;
import com.yanzuoguang.util.vo.PageSizeData;
import org.springframework.stereotype.Service;
@Service
public class CompanyAgreementServiceImpl implements CompanyAgreementService {
@Autowired
private CompanyAgreementDao companyAgreementDao;
private final CompanyAgreementDao companyAgreementDao;
private final CompanyDao companyDao;
private final CompanyExtendDao companyExtendDao;
public CompanyAgreementServiceImpl(CompanyAgreementDao companyAgreementDao, CompanyDao companyDao, CompanyExtendDao companyExtendDao) {
this.companyAgreementDao = companyAgreementDao;
this.companyDao = companyDao;
this.companyExtendDao = companyExtendDao;
}
@Override
public CompanyAgreementResVo checkAgreement(CompanyAgreementReqVo req) {
......@@ -23,8 +39,20 @@ public class CompanyAgreementServiceImpl implements CompanyAgreementService {
return companyAgreementResVo;
}
@Override
public PageSizeData<CompanyAgreementVo> findCompanyAgreement(CompanyAgreementReqVo req) {
PageSizeData<CompanyAgreementVo> companyAgreementResVo = companyAgreementDao.findCompanyAgreement(req);
return companyAgreementResVo;
}
@Override
public CompanyAgreementVo saveCompanyAgreement(CompanyAgreementReqVo req) {
CompanyResVo companyResVo = companyDao.load(req.getCompanyId(), CompanyResVo.class);
if(StringHelper.isEmpty(companyResVo)){
throw new CodeException("未找到公司信息");
}
String id = StringHelper.getMD5Id(req.getCompanyId(), req.getAgreementCode());
CompanyAgreementVo companyAgreementVo = companyAgreementDao.load(id, CompanyAgreementVo.class);
if (!StringHelper.isEmpty(companyAgreementVo)) {
......@@ -34,6 +62,37 @@ public class CompanyAgreementServiceImpl implements CompanyAgreementService {
ObjectHelper.writeWithFrom(companyAgreementVo, req);
companyAgreementVo.setCompanyAgreementId(id);
companyAgreementDao.create(companyAgreementVo);
CompanyExtendVo companyExtendVo = new CompanyExtendVo();
ObjectHelper.writeWithFromClass(companyExtendVo, companyResVo);
// 设置提现信息
companyExtendVo.setWithdrawRule(1);
companyExtendVo.setWithdrawType("D0");
companyExtendVo.setWithdrawDateType(0);
companyExtendVo.setMinWithdrawMoney(1d);
companyExtendVo.setMaxWithdrawMoney(2000000d);
companyExtendVo.setWithdrawFee(1d);
companyExtendVo.setDiscountRule(0);
// 设置系统服务费
companyExtendVo.setServiceChargeStatus(req.getServiceChargeStatus());
companyExtendVo.setServiceChargeMoneyType(req.getServiceChargeMoneyType());
companyExtendVo.setServiceChargePayType(req.getServiceChargePayType());
companyExtendVo.setServiceChargeType(req.getServiceChargeType());
companyExtendVo.setServiceCharge(req.getServiceCharge());
// 设置分润信息
companyExtendVo.setDivideStatus(0);
companyExtendVo.setScanCodePayStatus(1);
companyExtendVo.setInvitationStatus(0);
companyExtendVo.setActivationStatus(0);
companyExtendDao.update(companyExtendVo);
CompanyVo companyVo = new CompanyVo();
ObjectHelper.writeWithFromClass(companyVo, companyResVo);
companyVo.setSigningStatus(1);
companyVo.setSigningTime(DateHelper.getNow());
companyVo.setSigningType(req.getSigningType());
companyVo.setExamineStatus(2);
companyDao.update(companyVo);
return companyAgreementVo;
}
......
......@@ -17,6 +17,7 @@ import com.pangding.web.authority.util.CompanyBankCardConstant;
import com.pangding.web.authority.util.RsaConstant;
import com.pangding.web.authority.vo.*;
import com.pangding.web.authority.vo.reqvo.*;
import com.pangding.web.authority.vo.reqvo.CompanyDivideReqVo;
import com.pangding.web.authority.vo.reqvo.CompanySaveReqVo;
import com.pangding.web.authority.vo.reqvo.OldSaveCompanyReqVo;
import com.pangding.web.authority.vo.resvo.*;
......@@ -1398,7 +1399,7 @@ public class CompanyServiceImpl implements CompanyService {
companyBankCardVo.setCompanyId(req.getCompanyVo().getId());
companyBankCardVo.setType(1);
companyBankCardVo.setStatus(0);
companyBankCardVo.setIsDefault(0);
companyBankCardVo.setIsDefault(1);
companyBankCardDao.create(companyBankCardVo);
} else {
ObjectHelper.writeWithFrom(companyBankCardVo, req.getCompanyBankCardVo());
......
......@@ -294,7 +294,7 @@ public class UserServiceImpl implements UserService {
userRoleDao.create(userRoleVo);
// 保存角色权限表 先查询默认权限,跟角色添加默认权限
AuthorityReqVo authorityReqVo = new AuthorityReqVo();
authorityReqVo.setAttribute(PangdConstant.ATTRIBUTE_SCENIC);
// authorityReqVo.setAttribute(PangdConstant.ATTRIBUTE_SCENIC);
authorityReqVo.setAuthorityLevel(AuthorityConstant.AUTHORITY_LEVEL_DEFAULT);
List<AuthorityResVo> authorityResVoList = authorityDao.loadList(authorityReqVo, AuthorityResVo.class);
for (int i = 0; i < authorityResVoList.size(); i++) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment