Commit cc8065f3 by hongzhong

Merge remote-tracking branch 'origin/dev_20210330' into dev_20210330

parents 57e688fc 4a5a6d39
......@@ -685,6 +685,15 @@ public class PractitionerController {
return result;
}
@RequestMapping("/updateInformedSheetById")
public Object updateInformedSheetById(@RequestBody UpdateInformedSheetByIdRequestVO requestVO) {
JsonResult result = new JsonResult();
CommonResultIDResponseVO responseVO = practitionerService.updateInformedSheetById(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
@RequestMapping("/queryInformedSheetById")
public Object queryInformedSheetById(@RequestBody IDRequestVO requestVO) {
JsonResult result = new JsonResult();
......
......@@ -6,7 +6,6 @@ import com.libs.pdf.PDFTemplate;
import com.yd.api.customer.service.CustomerService;
import com.yd.api.customer.vo.register.RegisterRequestVO;
import com.yd.api.customer.vo.register.RegisterResponseVO;
import com.yd.api.practitioner.vo.hiring.CommonResultResponseVO;
import com.yd.api.practitioner.vo.informed.*;
import com.yd.api.practitioner.vo.login.CanSeeSalaryListResponseVO;
import com.yd.api.practitioner.vo.login.PractitionerLoginBasicInfo;
......@@ -42,6 +41,7 @@ import com.yd.dal.entity.survey.SurveyCustomerAnswers;
import com.yd.dal.entity.user.AclUser;
import com.yd.dal.mapper.customer.AclPolicyholderMapper;
import com.yd.dal.mapper.customer.AgPoInformedMapper;
import com.yd.dal.mapper.marketing.MktLeadsAssignedsMapper;
import com.yd.dal.service.agms.AgmsDashboardDALService;
import com.yd.dal.service.customer.*;
import com.yd.dal.service.marketing.*;
......@@ -182,6 +182,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
private AclPolicyholderMapper aclPolicyholderMapper;
@Autowired
private AgPoInformedMapper informedMapper;
@Autowired
private MktLeadsAssignedsMapper mktLeadsAssignedsMapper;
@Override
public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) {
......@@ -3609,9 +3611,17 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
public CommonResultIDResponseVO saveInformedSheet(SaveInformedSheetRequestVO requestVO) {
CommonResultIDResponseVO resp = new CommonResultIDResponseVO();
try {
// 先判断传入的客户姓名和客户电话与传入的customerId是否一致
AclCustomer aclCustomer = aclCustomerDALService.findById(requestVO.getCustomerId());
String customerName = requestVO.getCustomerName();
String customerMobile = requestVO.getCustomerMobile();
if (!customerMobile.equals(aclCustomer.getMobileNo())) {
}
// 数据库实体
AgPoInformed informed = new AgPoInformed();
BeanUtils.copyProperties(requestVO, informed);
informed.setCustomerId(aclCustomer.getId());
informed.setStatus("0");
informed.setIsActive(1);
......@@ -3625,6 +3635,30 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
informedMapper.insertSelective(informed);
// 商机更新一条告知书待签署的记录
MktLeadsAssignedTrack track = new MktLeadsAssignedTrack();
track.setCustomerId(requestVO.getLeadsAssignedId());
track.setTrackTime(curDate);
track.setCreatedBy(loginId);
track.setCreatedAt(new Date());
track.setCreatorType(1);
track.setUpdatedBy(loginId);
track.setUpdatorType(1);
track.setUpdatedAt(new Date());
MdDropOptions dropOption = systemConfigService.getDropOption("action_code", "customerNotice_0");
track.setMdDropOptionId(dropOption.getId());
track.setTrackScore(dropOption.getDropOptionScore());
//保存
mktLeadsAssignedTrackDALService.saveTrack(track);
// 如果名字不一样,就更新商机的名字
// if () {
// AclCustomer customer = aclCustomerDALService.findById(requestVO.getCustomerId());
// }
// MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
// mktLeadsAssigneds
// mktLeadsAssignedsMapper.updateByPrimaryKeySelective();
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
resp.setId(informed.getId());
} catch (Exception e) {
......@@ -3654,23 +3688,16 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
public CommonResultIDResponseVO updateInformedSheetById(UpdateInformedSheetByIdRequestVO requestVO) {
CommonResultIDResponseVO resp = new CommonResultIDResponseVO();
try {
// AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId());
// BeanUtils.copyProperties(requestVO, informed);
//
//
// informed.setUpdatedAt( new Date());
//
// Long loginId = requestVO.getLoginId();
// informed.setCreatedBy(loginId);
// informed.setUpdatedBy(loginId);
// 更新保单号
AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId());
BeanUtils.copyProperties(requestVO, informed);
informed.setUpdatedBy(requestVO.getLoginId());
informed.setUpdatedAt(new Date());
informedMapper.updateByPrimaryKeySelective(informed);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
// resp.setId(informed.getId());
resp.setId(informed.getId());
} catch (Exception e) {
e.printStackTrace();
resp.setCommonResult(new CommonResult(false, e.getMessage()));
......@@ -3695,28 +3722,84 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
byte[] fileBytes = Base64.getDecoder().decode(imgStr);
InputStream inputStream = new ByteArrayInputStream(fileBytes);
// 上传图片至阿里云
// 上传签名图片至阿里云
StringBuffer fileName = new StringBuffer();
fileName.append("InformedSheet/").append(id).append("/");
String originalFilename = generateKey(10);
String key = fileName.append(originalFilename).append(".png").toString();
String putFileToOss = ossService.putFileToOss(null, key, inputStream);
// 保存入库
// 更新
AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId());
informed.setId(id);
informed.setSignOssPath(putFileToOss);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String signDate = format.format(new Date());
Date curDate = new Date();
String signDate = format.format(curDate);
informed.setInformedNo(this.getNextInformedNo());
informed.setSignDate(signDate);
informed.setStatus("1");
informedMapper.updateByPrimaryKeySelective(informed);
// 商机更新一条告知书待签署的记录
MktLeadsAssignedTrack track = new MktLeadsAssignedTrack();
track.setCustomerId(informed.getLeadsId());
track.setTrackTime(curDate);
track.setCreatedBy(informed.getLeadsId());
track.setCreatedAt(curDate);
track.setCreatorType(1);
track.setUpdatedBy(informed.getLeadsId());
track.setUpdatorType(1);
track.setUpdatedAt(new Date());
MdDropOptions dropOption = systemConfigService.getDropOption("action_code", "customerNotice_1");
track.setMdDropOptionId(dropOption.getId());
track.setTrackScore(dropOption.getDropOptionScore());
//保存
mktLeadsAssignedTrackDALService.saveTrack(track);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
// 生成pdf
new Thread(new Runnable() {
@Override
public void run() {
AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId());
if (informed != null) {
String templatePDF = PDFConfiguration.getProperty("informed.pdf.template");
//模板文件生成临时文件目录
String tmpPathPDF = PDFConfiguration.getProperty("informed.pdf.temp.path");
//PDF模板输出结果文件
String templateResultPDF = tmpPathPDF + informed.getId() + "-signedInformed.pdf";
//填充数据
Map<String, String> initDatas = new HashMap<>();
Map<String, String> initImages = new HashMap<>();
//下载图片
String signPicture = this.getImgTolocal(tmpPathPDF,"sign.png", informed.getSignOssPath());
initImages.put("p_name", signPicture);
String pDate = informed.getSignDate();
initDatas.put("p_date", pDate);
//按模板填充数据生成结果PDF
PDFTemplate.generatePDF(templatePDF, templateResultPDF, initDatas, initImages);
try {
//上传至oss ossService
String ossPath = this.putContractFileToOSS("informed", templateResultPDF, informed.getId());
informed.setInformedOssPath(ossPath);
informedMapper.updateByPrimaryKeySelective(informed);
}catch (Exception e) {
e.printStackTrace();
}
}
}
private String getImgTolocal(String localDirectory, String filename, String imgUrl) {
Map<String, Object> input = HttpUtil.getInput(imgUrl);
if (!(boolean) input.get("success")) {
......@@ -3806,42 +3889,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return ossPath;
}
@Override
public void run() {
AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId());
if (informed != null) {
String templatePDF = PDFConfiguration.getProperty("informed.pdf.template");
//模板文件生成临时文件目录
String tmpPathPDF = PDFConfiguration.getProperty("informed.pdf.temp.path");
//PDF模板输出结果文件
String templateResultPDF = tmpPathPDF + informed.getId() + "-signedInformed.pdf";
//填充数据
Map<String, String> initDatas = new HashMap<>();
Map<String, String> initImages = new HashMap<>();
//下载图片
String signPicture = this.getImgTolocal(tmpPathPDF,"sign.png", informed.getSignOssPath());
initImages.put("p_name", signPicture);
String pDate = informed.getSignDate();
initDatas.put("p_date", pDate);
//按模板填充数据生成结果PDF
PDFTemplate.generatePDF(templatePDF, templateResultPDF, initDatas, initImages);
try {
//上传至oss ossService
String ossPath = this.putContractFileToOSS("informed", templateResultPDF, informed.getId());
informed.setInformedOssPath(ossPath);
informedMapper.updateByPrimaryKeySelective(informed);
}catch (Exception e) {
e.printStackTrace();
}
}
}
}).start();
} catch (Exception e) {
......@@ -3851,6 +3898,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return resp;
}
private String getNextInformedNo() {
return informedMapper.getNextInformedNo();
}
@Override
public QueryInformedSheetListResponseVO queryInformedSheetList(QueryInformedSheetListRequestVO requestVO) {
QueryInformedSheetListResponseVO resp = new QueryInformedSheetListResponseVO();
......
......@@ -5,5 +5,15 @@ import lombok.Data;
@Data
public class UpdateInformedSheetByIdRequestVO {
private Long id;
private String imgStr;
/**
* 保单号
*/
private String policyNo;
/**
* 备注
*/
private String remark;
private Long loginId;
}
......@@ -18,4 +18,6 @@ public interface AgPoInformedMapper {
int updateByPrimaryKey(AgPoInformed record);
List<AgPoInformed> selectByRecord(AgPoInformed record);
String getNextInformedNo();
}
\ No newline at end of file
package com.yd.rmi.cache;
import com.yd.dal.entity.meta.MdCode;
import com.yd.dal.entity.meta.MdIncometaxRate;
import com.yd.dal.entity.meta.MdMkCampaign;
import com.yd.dal.entity.meta.MdPractitionerHiringApproveSteps;
import com.yd.dal.service.meta.MdCodeDALService;
import com.yd.dal.service.meta.MdIncometaxRateDALService;
import com.yd.dal.service.meta.MdMkCampaignDALService;
import com.yd.dal.service.meta.MdPractitionerHiringApproveStepsDALService;
import com.yd.dal.entity.meta.*;
import com.yd.dal.service.meta.*;
import com.yd.rmi.ali.ossinterf.service.AliOssInterfService;
import com.yd.util.CommonUtil;
import net.sf.ehcache.Cache;
......@@ -39,6 +33,8 @@ public class SystemConfigService implements CommandLineRunner{
private MdMkCampaignDALService mdMkCampaignDALService;
@Autowired
private MdIncometaxRateDALService mdIncometaxRateDALService;
@Autowired
private MdDropOptionsDALService mdDropOptionsDALService;
/**
* 保存cache
......@@ -248,7 +244,21 @@ public class SystemConfigService implements CommandLineRunner{
return incometaxRates;
}
public MdDropOptions getDropOption(String masterCode, String optionCode) {
if (CommonUtil.isNullOrBlank(masterCode) || CommonUtil.isNullOrBlank(optionCode)) {
return null;
}
MdDropOptions mdDropOption;
Element element = systemConfigCache.get(masterCode + optionCode);
if (element != null && element.getObjectValue() != null) {
mdDropOption = (MdDropOptions) element.getObjectValue();
} else {
mdDropOption = mdDropOptionsDALService.selectByMasterCodeAndOptionsCode(masterCode, optionCode);
element = new Element(masterCode + optionCode, mdDropOption);
systemConfigCache.put(element);
}
return mdDropOption;
}
@SuppressWarnings("unchecked")
public List<MdPractitionerHiringApproveSteps> findHiringApproveStepsByPractitionerLevel(String practitionerLevelCode) {
......
......@@ -1403,8 +1403,8 @@
<select id="ownOpportunityQuery" resultMap="opportunityQuery">
SELECT
a.customer_id opportunityId,
c.NAME name,
c.mobile_no mobileNo,
IFNULL(a.customer_name,c.NAME) name,
IFNULL(a.customer_mobile,c.mobile_no) mobileNo,
date_format(a.created_at, '%Y-%m-%d %H:%i:%s') opportunityDate,
if (p.source_from = 0 ,(SELECT cam.name from ag_md_mk_campaign cam where cam.id = p.mkt_campaign ),(SELECT md.drop_option_name from ag_md_drop_options md where p.source_from = md.id )) opportunityFrom,
a.id leadsAssignedId ,
......
......@@ -237,8 +237,8 @@
<if test="customerMobile != null">
and customer_mobile = #{customerMobile,jdbcType=VARCHAR}
</if>
<if test="updatedAt != null">
and practitioner_id = #{updatedAt,jdbcType=BIGINT}
<if test="practitionerId != null">
and practitioner_id = #{practitionerId,jdbcType=BIGINT}
</if>
<if test="policyNo != null">
and policy_no = #{policyNo,jdbcType=VARCHAR}
......@@ -247,4 +247,7 @@
and sign_date = #{signDate,jdbcType=VARCHAR}
</if>
</select>
<select id="getNextInformedNo" resultType="java.lang.String" statementType="CALLABLE">
select f_getNextInformedNo()
</select>
</mapper>
\ No newline at end of file
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