Commit 9f7ad72c by wenyang Committed by jianan

AGMS增加经纪人报聘信息的查询与导出,在原有‘审批流程’页面上增加查询条件(申请开始日期,申请结束日期)

parent e7b8f495
......@@ -342,6 +342,35 @@ public class AgmsController {
result.addResult(responseVO);
return result;
}
/**
* AGMS -- 经纪人报聘列表查询
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping(value = "/practitionerApplyList")
public Object practitionerApplyList(@RequestBody PractitionerHiringListRequestVO requestVO) {
JsonResult result = new JsonResult();
PractitionerHiringListResponseVO responseVO = agmsHiringService.practitionerApplyList(requestVO);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
/**
* AGMS -- 经纪人报聘列表导出
* @param requestVO 请求数据
* @param response 返回数据流
* @return 响应数据
*/
@RequestMapping(value = "/exportPractitionerApplyList")
public Object exportPractitionerApplyList(@RequestBody PractitionerHiringListRequestVO requestVO, HttpServletResponse response) {
JsonResult result = new JsonResult();
CommonResultResponseVO responseVO = agmsHiringService.exportPractitionerApplyList(requestVO,response);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
/**
* 上传公司印章接口
......
package com.yd.api.agms.service;
import javax.servlet.http.HttpServletResponse;
import com.yd.api.agms.vo.hiring.*;
import com.yd.api.result.CommonResultResponseVO;
/**
* @author xxy
......@@ -28,4 +31,9 @@ public interface AgmsHiringService {
PractitionerHiringApproveResponseVO practitionerHiringApprove(PractitionerHiringApproveRequestVO requestVO);
PractitionerHiringListResponseVO practitionerHiringListV2(PractitionerHiringListRequestVO requestVO);
PractitionerHiringListResponseVO practitionerApplyList(PractitionerHiringListRequestVO requestVO);
CommonResultResponseVO exportPractitionerApplyList(PractitionerHiringListRequestVO requestVO,HttpServletResponse response);
}
......@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
import com.yd.api.agms.service.AgmsHiringService;
import com.yd.api.agms.vo.hiring.*;
import com.yd.api.result.CommonResult;
import com.yd.api.result.CommonResultResponseVO;
import com.yd.dal.entity.agms.hiring.*;
import com.yd.dal.entity.customer.*;
import com.yd.dal.entity.meta.MdDropOptions;
......@@ -32,11 +33,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
/**
* @author xxy
*/
......@@ -338,6 +343,142 @@ public class AgmsHiringServiceImpl implements AgmsHiringService {
return resp;
}
/**
* AGMS -- 经纪人报聘列表查询
* @param requestVO 请求数据
* @return 响应数据
*/
@Override
public PractitionerHiringListResponseVO practitionerApplyList(PractitionerHiringListRequestVO requestVO) {
PractitionerHiringListResponseVO resp = new PractitionerHiringListResponseVO();
resp.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("800001")));
if (requestVO == null) {
resp.setCommonResult(new CommonResult(false, "请求对象不能为空!"));
return resp;
}else{
if (CommonUtil.isNullOrBlank(requestVO.getStatus())) {
resp.setCommonResult(new CommonResult(false, "请求信息中【审批状态】不能为空!"));
return resp;
}else if (CommonUtil.isNullOrBlank(requestVO.getEndDate())) {
resp.setCommonResult(new CommonResult(false, "请求信息中【报聘申请结束日期】不能为空!"));
return resp;
}
}
if (!CommonUtil.isNullOrBlank(requestVO.getName())) {
requestVO.setName("%"+requestVO.getName()+"%");
}
try {
List<PractitionerHiringListInfo> list = agmsHiringDalService.practitionerApplyList(requestVO);
resp.setPractitionerHiringList(PageInfoUtils.list2PageInfo(list, requestVO.getPageInfo().getPageNum(), requestVO.getPageInfo().getPageSize()));
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
} catch (Exception e) {
e.printStackTrace();
}
return resp;
}
/**
* AGMS -- 经纪人报聘列表导出
* @param requestVO 请求数据
* @param response 返回数据流
* @return 响应数据
*/
@Override
public CommonResultResponseVO exportPractitionerApplyList(PractitionerHiringListRequestVO requestVO,HttpServletResponse response) {
CommonResultResponseVO resp = new CommonResultResponseVO();
resp.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("800001")));
if (requestVO == null) {
resp.setCommonResult(new CommonResult(false, "请求对象不能为空!"));
return resp;
}else{
if (CommonUtil.isNullOrBlank(requestVO.getStatus())) {
resp.setCommonResult(new CommonResult(false, "请求信息中【审批状态】不能为空!"));
return resp;
}else if (CommonUtil.isNullOrBlank(requestVO.getEndDate())) {
resp.setCommonResult(new CommonResult(false, "请求信息中【报聘申请结束日期】不能为空!"));
return resp;
}
}
if (!CommonUtil.isNullOrBlank(requestVO.getName())) {
requestVO.setName("%"+requestVO.getName()+"%");
}
try {
List<PractitionerHiringListInfo> list = agmsHiringDalService.practitionerApplyList(requestVO);
createCSV(list, response);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
} catch (Exception e) {
e.printStackTrace();
}
return resp;
}
private void createCSV(List<PractitionerHiringListInfo> practitionerHiringListInfos, HttpServletResponse response) {
String charset = "UTF-8"; // 读取字符编码
String[] columnName = new String[]{"序号", "审批状态", "审批日期", "姓名", "手机号", "报聘职级", "辅导人", "介绍人", "体系", "分公司", "申请日期"};
String tableName = "YD_Export_PractitionerArrly";
String CSV_COLUMN_SEPARATOR = ",";//CSV文件列分隔符
String CSV_ROW_SEPARATOR = "\r\n";//CSV文件行分隔符
// 保证线程安全
StringBuilder buf = new StringBuilder();
// 组装表头
for (String title : columnName) {
buf.append(title).append(CSV_COLUMN_SEPARATOR);
}
buf.append(CSV_ROW_SEPARATOR);
// 组装数据
if (CollectionUtils.isNotEmpty(practitionerHiringListInfos)) {
for (int i = 0; i < practitionerHiringListInfos.size(); i++) {
PractitionerHiringListInfo info = practitionerHiringListInfos.get(i);//遍历每个对象
buf.append(i + 1).append(CSV_COLUMN_SEPARATOR);
if("0".equals(info.getStatus())){
buf.append("待审批").append(CSV_COLUMN_SEPARATOR);
}else if("1".equals(info.getStatus())){
buf.append("通过").append(CSV_COLUMN_SEPARATOR);
}else if("2".equals(info.getStatus())){
buf.append("拒绝").append(CSV_COLUMN_SEPARATOR);
}
buf.append(info.getApprovingTime() == null ? "" : info.getApprovingTime()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getName() == null ? "" : info.getName()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getMobileNo() == null ? "" : info.getMobileNo()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getPractitionerLevel() == null ? "" : info.getPractitionerLevel()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getMentor() == null ? "" : info.getMentor()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getIntroducer() == null ? "" : info.getIntroducer()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getSubsystem() == null ? "" : info.getSubsystem()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getBranch() == null ? "" : info.getBranch()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getApplicationTime() == null ? "" : info.getApplicationTime()).append(CSV_COLUMN_SEPARATOR);
buf.append(CSV_ROW_SEPARATOR);
}
}
// 设置文件后缀
String fn = tableName + System.currentTimeMillis() + ".csv";
String headStr = "attachment; filename=\"" + fn + "\"";
// 设置响应
response.setContentType("APPLICATION/ms-csv.numberformat");
response.setCharacterEncoding(charset);
response.setHeader("Content-Disposition", headStr);
response.setHeader("Cache-Control", "max-age=30");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Pragma", "public");
OutputStream os = null;
try {
os = response.getOutputStream();
os.write(buf.toString().getBytes("GBK"));
os.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@SuppressWarnings("unchecked")
private void saveRecords(Long loginPractitionerId,
String mobileNo, List<MdPractitionerHiringApproveSteps> hiringApproveStepsList,
......
......@@ -18,6 +18,8 @@ public class PractitionerHiringListRequestVO {
private Long s3Id;
private Long s2Id;
private Long s1Id;
private String startDate;
private String endDate;
private PageInfo<PractitionerHiringListInfo> pageInfo;
......@@ -115,4 +117,21 @@ public class PractitionerHiringListRequestVO {
public void setS1Id(Long s1Id) {
this.s1Id = s1Id;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}
......@@ -79,4 +79,15 @@ public interface AgmsHiringMapper {
);
List<PractitionerHiringListInfo> queryS2List(@Param("approveStatus")String approveStatus);
Page<PractitionerHiringListInfo> practitionerApplyList(@Param("approveStatus")String approveStatus,
@Param("list")List<String> canAprroveGrades,
@Param("branchId")Long branchId,
@Param("deptId")Long deptId,
@Param("subsystemIdList")List<Long> subsystemIdList,
@Param("name")String name,
@Param("startDate")String startDate,
@Param("endDate")String endDate
);
}
......@@ -65,6 +65,8 @@ public interface AgmsHiringDALService {
PageInfo<PractitionerHiringListInfo> queryHandledList(Long practitionerId, String status,
PractitionerHiringListRequestVO requestVO);
List<PractitionerHiringListInfo> practitionerApplyList(PractitionerHiringListRequestVO requestVO);
List<PractitionerHiringListInfo> queryUnhandledList(PractitionerHiringListRequestVO requestVO);
......
......@@ -412,4 +412,22 @@ public class AgmsHiringDALServiceImpl implements AgmsHiringDALService {
return uniqueList;
}
@Override
public List<PractitionerHiringListInfo> practitionerApplyList(PractitionerHiringListRequestVO requestVO) {
//体系查询调整,如果体系为S3,则需要查询它下面的所有子集
PractitionerSubordinateInfo practitionerSubordinateInfo = new PractitionerSubordinateInfo();
BeanUtils.copyProperties(requestVO,practitionerSubordinateInfo);
practitionerSubordinateInfo.setInsurerBranchId(requestVO.getBranchId());
List<Long> subsystemIdList = aclPractitionerSubordinateSystemDalService.getLongs(practitionerSubordinateInfo);
List<PractitionerHiringListInfo> resultList = agmsHiringMapper.practitionerApplyList(requestVO.getStatus(), null,
requestVO.getBranchId(),
requestVO.getDeptId(),
subsystemIdList,
requestVO.getName(),
requestVO.getStartDate(),
requestVO.getEndDate());
return resultList;
}
}
......@@ -334,4 +334,73 @@
)
</select>
<select id="practitionerApplyList" resultMap="practitionerHiringListInfo">
select b.id hiringBasicInfoId,
b.name name,
b.mobile_no mobileNo,
m.md_drop_option_name practitionerLevel,
m.mentor mentor,
m.introducer introducer,
m.subsystem subsystem,
m.branch branch,
date_format(b.created_at, '%Y-%m-%d %H:%i:%s') applicationTime,
<if test="approveStatus != null">
<choose>
<when test='approveStatus == "1" '>
#{approveStatus} as status,
(select max(r.created_at) from ag_acl_practitioner_hiring_approve_records r where r.hiring_basic_info_id = b.id ) as approvingTime
</when>
<when test='approveStatus != "1" '>
#{approveStatus} as status,
null as approvingTime
</when>
</choose>
</if>
from ag_acl_practitioner_hiring_basic_info b
left join ag_acl_practitioner_hiring_membership m on b.id = m.hiring_basic_info_id
left join ag_acl_practitioner_subordinate_system sys on sys.id = m.subsystem_id
where 1 = 1
<if test="approveStatus != null">
<choose>
<when test='approveStatus == "0" '>
and b.approve_status not in ('0' , '2')
</when>
<when test='approveStatus == "1" '>
and b.approve_status = '0'
</when>
<when test='approveStatus == "2" '>
and b.approve_status = '-1'
</when>
</choose>
</if>
<if test="startDate != null ">
and b.created_at &gt;= #{startDate}
</if>
<if test="endDate != null ">
and b.created_at &lt;= #{endDate}
</if>
<if test="list != null and list.size() > 0">
and m.md_drop_option_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="branchId != null">
and m.branch_id = #{branchId}
</if>
<if test="deptId != null">
and sys.dept_id = #{deptId}
</if>
<if test="subsystemIdList != null and subsystemIdList.size() > 0">
and m.subsystem_id in
<foreach collection="subsystemIdList" index="index" item="subsystemId" open="(" separator="," close=")">
#{subsystemId}
</foreach>
</if>
<if test="name != null">
and b.name like #{name}
</if>
</select>
</mapper>
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