Commit 5cad6c31 by yao.xiao

测试印章上传

parent a9bc0382
package com.yd.api.agms; package com.yd.api.agms;
import com.yd.api.agms.service.AgmsDashboardService; import com.yd.api.agms.service.*;
import com.yd.api.agms.service.AgmsFortuneService;
import com.yd.api.agms.service.AgmsHiringService;
import com.yd.api.agms.vo.dashboard.*; import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.agms.service.AgmsStatisticsService;
import com.yd.api.agms.vo.fortune.*; import com.yd.api.agms.vo.fortune.*;
import com.yd.api.agms.vo.hiring.*; import com.yd.api.agms.vo.hiring.*;
import com.yd.api.agms.vo.insurer.SealUploadResponseVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO; import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO; import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO; import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO;
...@@ -16,10 +14,8 @@ import com.yd.api.practitioner.vo.hiring.HiringApproveResponseVO; ...@@ -16,10 +14,8 @@ import com.yd.api.practitioner.vo.hiring.HiringApproveResponseVO;
import com.yd.api.result.JsonResult; import com.yd.api.result.JsonResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -35,6 +31,8 @@ public class AgmsController { ...@@ -35,6 +31,8 @@ public class AgmsController {
private AgmsFortuneService agmsFortuneService; private AgmsFortuneService agmsFortuneService;
@Autowired @Autowired
private AgmsHiringService agmsHiringService; private AgmsHiringService agmsHiringService;
@Autowired
private AgmsInsurerService agmsInsurerService;
/** /**
* AGMS -- 财务管理报表 * AGMS -- 财务管理报表
...@@ -286,4 +284,25 @@ public class AgmsController { ...@@ -286,4 +284,25 @@ public class AgmsController {
result.addResult(responseVO); result.addResult(responseVO);
return result; return result;
} }
/**
* 上传公司印章接口
* @param sealFile
* @param loginId
* @param insurerBranchId
* @param insurerBranchDeptId
* @return
*/
@RequestMapping(value="/sealUpload")
public Object sealUpload(@RequestParam(value = "sealFile") MultipartFile sealFile,
@RequestParam(value = "loginId",required = true) Long loginId,
@RequestParam(value = "insurerBranchId",required = false) Long insurerBranchId,
@RequestParam(value = "insurerBranchDeptId",required = false) Long insurerBranchDeptId) {
JsonResult result = new JsonResult();
SealUploadResponseVO responseVO = agmsInsurerService.sealUpload(sealFile,loginId,insurerBranchId,insurerBranchDeptId);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
} }
package com.yd.api.agms.service;
import com.yd.api.agms.vo.hiring.PractitionerHiringListResponseVO;
import com.yd.api.agms.vo.insurer.SealUploadResponseVO;
import org.springframework.web.multipart.MultipartFile;
/**
* @author xxy
*/
public interface AgmsInsurerService {
/**
* 上传公司印章接口
* @param sealFile
* @param loginId
* @param insurerBranchId
* @param insurerBranchDeptId
* @return
*/
SealUploadResponseVO sealUpload(MultipartFile sealFile, Long loginId, Long insurerBranchId, Long insurerBranchDeptId);
}
package com.yd.api.agms.service.impl;
import com.yd.api.agms.service.AgmsInsurerService;
import com.yd.api.agms.vo.insurer.SealUploadResponseVO;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.AclInsurerBranch;
import com.yd.dal.entity.customer.AclInsurerBranchDept;
import com.yd.dal.service.customer.AclInsurerBranchDALService;
import com.yd.dal.service.customer.AclInsurerBranchDeptDALService;
import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.InetAddress;
import java.util.Date;
/**
* @author xxy
*/
@Service("agmsInsurerService")
@PropertySource({"classpath:pdfconfiguration.properties"})
public class AgmsInsurerServiceImpl implements AgmsInsurerService {
@Value("${pdf.signImage}")
private String signImage;
@Autowired
private AclInsurerBranchDALService aclInsurerBranchDALService;
@Autowired
private AclInsurerBranchDeptDALService aclInsurerBranchDeptDALService;
@Override
public SealUploadResponseVO sealUpload(MultipartFile sealFile, Long loginId, Long insurerBranchId, Long insurerBranchDeptId) {
SealUploadResponseVO responseVO = new SealUploadResponseVO();
boolean success = true;
String message = ZHBErrorConfig.getErrorInfo("800000");
try {
byte[] bytes = sealFile.getBytes();
InputStream in = new ByteArrayInputStream(bytes);
InetAddress address = InetAddress.getLocalHost();
File outFile = new File(signImage + sealFile.getName());
System.out.println("http://" + address + signImage);
// File outFile = new File("D:\\"+sealFile.getOriginalFilename());
FileOutputStream out = new FileOutputStream(outFile);
byte[] bts = new byte[1024];
int len = 0;
while ((len = in.read(bts)) != -1) {
out.write(bts, 0, len);
}
if (!CommonUtil.isNullOrZero(insurerBranchId)) {
AclInsurerBranch branch = new AclInsurerBranch();
branch.setId(insurerBranchId);
branch.setElectronicTaxSeal("http://" + address + signImage);
branch.setUpdatedAt(new Date());
branch.setUpdatedBy(loginId);
aclInsurerBranchDALService.update(branch);
}
if (!CommonUtil.isNullOrZero(insurerBranchDeptId)) {
AclInsurerBranchDept dept = new AclInsurerBranchDept();
dept.setId(insurerBranchDeptId);
dept.setElectronicTaxSeal("http://" + address + signImage);
dept.setUpdatedAt(new Date());
dept.setUpdatedBy(loginId);
aclInsurerBranchDeptDALService.update(dept);
}
responseVO.setFileUrl("http://" + address + signImage);
} catch (Exception e) {
success = false;
message = ZHBErrorConfig.getErrorInfo("830025");
e.printStackTrace();
}
responseVO.setCommonResult(new CommonResult(success, message));
return responseVO;
}
}
package com.yd.api.agms.vo.insurer;
import com.yd.api.result.CommonResult;
/**
* @author xxy
*/
public class SealUploadResponseVO {
private String fileUrl;
private CommonResult commonResult;
/**
* 获取
*
* @return the commonResult
*/
public CommonResult getCommonResult() {
return this.commonResult;
}
/**
* 设置
*
* @param commonResult the to set
*/
public void setCommonResult(CommonResult commonResult) {
this.commonResult = commonResult;
}
/**
* 获取
*
* @return the fileUrl
*/
public String getFileUrl() {
return this.fileUrl;
}
/**
* 设置
*
* @param fileUrl the to set
*/
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
@Override
public String toString() {
return "SealUploadResponseVO{" +
"fileUrl='" + fileUrl + '\'' +
", commonResult=" + commonResult +
'}';
}
}
package com.yd.dal.entity.customer;
import java.util.Date;
import lombok.Data;
/**
* 保险公司分公司/营业部
*/
@Data
public class AclInsurerBranch {
/**
* serial id
*/
private Long id;
/**
* 分公司/营业部代码
*/
private String branchCode;
/**
* FK ag_acl_insurer.id
*/
private Long insurerId;
/**
* 保险公司名称
*/
private String insurerName;
/**
* 分公司/营业部名称
*/
private String branchName;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 有效起日
*/
private Date effectiveStartDate;
/**
* 有效终日
*/
private Date effectiveEndDate;
/**
* 联系人
*/
private String contactName;
/**
* 联系电话
*/
private String contactNo;
/**
* 分公司地址
*/
private String address;
/**
* 分公司电子印章
*/
private String electronicTaxSeal;
/**
* 备注
*/
private String remark;
private Date createdAt;
private Long createdBy;
private Date updatedAt;
private Long updatedBy;
}
\ No newline at end of file
package com.yd.dal.entity.customer;
import java.util.Date;
import lombok.Data;
/**
* 经纪人所属部门
*/
@Data
public class AclInsurerBranchDept {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_insurer.id
*/
private Long insurerId;
/**
* FK ag_acl_insurer.id
*/
private Long insurerBranchId;
private String deptCode;
/**
* dept name
*/
private String name;
/**
* dept english name
*/
private String nameEn;
/**
* 联系人
*/
private String contactName;
/**
* 联系电话
*/
private String contactNo;
/**
* 部门地址
*/
private String address;
/**
* 经纪人所属部门电子印章
*/
private String electronicTaxSeal;
/**
* memo or tips
*/
private String remark;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
private Date createdAt;
/**
* FK ag_acl_user.id
*/
private Long createdBy;
private Date updatedAt;
/**
* FK ag_acl_user.id
*/
private Long updatedBy;
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclInsurerBranchDept;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclInsurerBranchDeptMapper {
int deleteByPrimaryKey(Long id);
int insert(AclInsurerBranchDept record);
int insertSelective(AclInsurerBranchDept record);
AclInsurerBranchDept selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclInsurerBranchDept record);
int updateByPrimaryKey(AclInsurerBranchDept record);
int updateBatch(List<AclInsurerBranchDept> list);
int updateBatchSelective(List<AclInsurerBranchDept> list);
int batchInsert(@Param("list") List<AclInsurerBranchDept> list);
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclInsurerBranch;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclInsurerBranchMapper {
int deleteByPrimaryKey(Long id);
int insert(AclInsurerBranch record);
int insertSelective(AclInsurerBranch record);
AclInsurerBranch selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclInsurerBranch record);
int updateByPrimaryKey(AclInsurerBranch record);
int updateBatch(List<AclInsurerBranch> list);
int updateBatchSelective(List<AclInsurerBranch> list);
int batchInsert(@Param("list") List<AclInsurerBranch> list);
}
\ No newline at end of file
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclInsurerBranch;
/**
* @author xxy
*/
public interface AclInsurerBranchDALService {
void update(AclInsurerBranch branch);
}
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclInsurerBranchDept;
import java.util.List;
/**
* @author xxy
*/
public interface AclInsurerBranchDeptDALService {
void update(AclInsurerBranchDept dept);
}
package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclInsurerBranch;
import com.yd.dal.mapper.customer.AclInsurerBranchMapper;
import com.yd.dal.service.customer.AclInsurerBranchDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author xxy
*/
@Service("aclInsurerBranchDALService")
public class AclInsurerBranchDALServiceImpl implements AclInsurerBranchDALService {
@Resource
private AclInsurerBranchMapper mapper;
@Override
public void update(AclInsurerBranch branch) {
mapper.updateByPrimaryKeySelective(branch);
}
}
package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclInsurerBranchDept;
import com.yd.dal.mapper.customer.AclInsurerBranchDeptMapper;
import com.yd.dal.service.customer.AclInsurerBranchDeptDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author xxy
*/
@Service("aclInsurerBranchDeptDALService")
public class AclInsurerBranchDeptDALServiceImpl implements AclInsurerBranchDeptDALService {
@Resource
private AclInsurerBranchDeptMapper mapper;
@Override
public void update(AclInsurerBranchDept dept) {
mapper.updateByPrimaryKeySelective(dept);
}
}
pdf.template=/opt/tomcat8/conf/ydpdf/pdfres/templatePractitionerContract.pdf pdf.template=/opt/tomcat8/conf/ydpdf/pdfres/templatePractitionerContract.pdf
pdf.signImage=/opt/tomcat8/conf/ydpdf/pdfres/yindunsign.png pdf.signImage=/opt/tomcat8/conf/ydpdf/pdfres/
pdf.keyStorePath=/opt/tomcat8/conf/ydpdf/pdfres/4929078_m.zuihuibi.cn.pfx pdf.keyStorePath=/opt/tomcat8/conf/ydpdf/pdfres/4929078_m.zuihuibi.cn.pfx
pdf.keyPassword=UC645YlB pdf.keyPassword=UC645YlB
......
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