Parcourir la source

Merge remote-tracking branch 'origin/master'

yanliming il y a 5 ans
Parent
commit
ade66ecf8c

BIN
document/后端接口.xlsx


+ 119 - 117
picc-common/src/main/resources/mapper/business/InsurancePolicy.xml

@@ -1,36 +1,36 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.picc.modules.business.dao.InsurancePolicyDAO">
-	<resultMap id="InsurancePolicyMap" type="com.jpsoft.picc.modules.business.entity.InsurancePolicy">
-		<id property="id" column="id_" />
-			<result property="status" column="status_" />
-			<result property="processStatus" column="process_status" />
-			<result property="insuranceFee" column="insurance_fee" />
-			<result property="startTime" column="start_time" />
-			<result property="endTime" column="end_time" />
-			<result property="number" column="number_" />
-			<result property="accountBank" column="account_bank" />
-			<result property="issuingBank" column="issuing_bank" />
-			<result property="singlNumber" column="singl_number" />
-			<result property="transferTime" column="transfer_time" />
-			<result property="agentId" column="agent_id" />
-			<result property="insurancePolicyFile" column="insurance_policy_file" />
-			<result property="no" column="no_" />
-			<result property="delFlag" column="del_flag" />
-			<result property="createBy" column="create_by" />
-			<result property="createTime" column="create_time" />
-			<result property="updateBy" column="update_by" />
-			<result property="updateTime" column="update_time" />
-			</resultMap>
-	<insert id="insert" parameterType="com.jpsoft.picc.modules.business.entity.InsurancePolicy">
-	<!--
-	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
-		select sys_guid() from dual
-	</selectKey>
-	-->
-	<![CDATA[
+    <resultMap id="InsurancePolicyMap" type="com.jpsoft.picc.modules.business.entity.InsurancePolicy">
+        <id property="id" column="id_" />
+        <result property="status" column="status_" />
+        <result property="processStatus" column="process_status" />
+        <result property="insuranceFee" column="insurance_fee" />
+        <result property="startTime" column="start_time" />
+        <result property="endTime" column="end_time" />
+        <result property="number" column="number_" />
+        <result property="accountBank" column="account_bank" />
+        <result property="issuingBank" column="issuing_bank" />
+        <result property="singlNumber" column="singl_number" />
+        <result property="transferTime" column="transfer_time" />
+        <result property="agentId" column="agent_id" />
+        <result property="insurancePolicyFile" column="insurance_policy_file" />
+        <result property="no" column="no_" />
+        <result property="delFlag" column="del_flag" />
+        <result property="createBy" column="create_by" />
+        <result property="createTime" column="create_time" />
+        <result property="updateBy" column="update_by" />
+        <result property="updateTime" column="update_time" />
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.picc.modules.business.entity.InsurancePolicy">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
 		insert into business_insurance_policy
 	    (id_,status_,process_status,insurance_fee,start_time,end_time,number_,account_bank,issuing_bank,singl_number,transfer_time,agent_id,insurance_policy_file,no_,del_flag,create_by,create_time,update_by,update_time)
 		values
@@ -56,92 +56,94 @@
 ,#{updateTime,jdbcType= TIMESTAMP }
 		)
 	]]>
-	</insert>
-	<delete id="delete" parameterType="string">
-		delete from business_insurance_policy where id_=#{id,jdbcType=VARCHAR}
-	</delete>
-	<update id="update" parameterType="com.jpsoft.picc.modules.business.entity.InsurancePolicy">
-		update business_insurance_policy
-		<set>
-				<if test="status!=null">
-		status_=#{status,jdbcType=VARCHAR},
-		</if>
-				<if test="processStatus!=null">
-		process_status=#{processStatus,jdbcType=VARCHAR},
-		</if>
-				<if test="insuranceFee!=null">
-		insurance_fee=#{insuranceFee,jdbcType= NUMERIC },
-		</if>
-				<if test="startTime!=null">
-		start_time=#{startTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="endTime!=null">
-		end_time=#{endTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="number!=null">
-		number_=#{number,jdbcType= NUMERIC },
-		</if>
-				<if test="accountBank!=null">
-		account_bank=#{accountBank,jdbcType=VARCHAR},
-		</if>
-				<if test="issuingBank!=null">
-		issuing_bank=#{issuingBank,jdbcType=VARCHAR},
-		</if>
-				<if test="singlNumber!=null">
-		singl_number=#{singlNumber,jdbcType=VARCHAR},
-		</if>
-				<if test="transferTime!=null">
-		transfer_time=#{transferTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="agentId!=null">
-		agent_id=#{agentId,jdbcType=VARCHAR},
-		</if>
-				<if test="insurancePolicyFile!=null">
-		insurance_policy_file=#{insurancePolicyFile,jdbcType=VARCHAR},
-		</if>
-				<if test="no!=null">
-		no_=#{no,jdbcType= NUMERIC },
-		</if>
-				<if test="delFlag!=null">
-		del_flag=#{delFlag,jdbcType= NUMERIC },
-		</if>
-				<if test="createBy!=null">
-		create_by=#{createBy,jdbcType=VARCHAR},
-		</if>
-				<if test="createTime!=null">
-		create_time=#{createTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="updateBy!=null">
-		update_by=#{updateBy,jdbcType=VARCHAR},
-		</if>
-				<if test="updateTime!=null">
-		update_time=#{updateTime,jdbcType= TIMESTAMP },
-		</if>
-		</set>
-	where id_=#{id}
-	</update>
-	<select id="get" parameterType="string" resultMap="InsurancePolicyMap">
-		select 
-id_,status_,process_status,insurance_fee,start_time,end_time,number_,account_bank,issuing_bank,singl_number,transfer_time,agent_id,insurance_policy_file,no_,del_flag,create_by,create_time,update_by,update_time		from business_insurance_policy where id_=#{0}
-	</select>
-	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from business_insurance_policy where id_=#{0} and del_flag = false
-	</select>
-	<select id="list" resultMap="InsurancePolicyMap">
-		select * from business_insurance_policy where del_flag = false
-	</select>
-	<select id="search" parameterType="hashmap" resultMap="InsurancePolicyMap">
-		<![CDATA[
-			select * from business_insurance_policy
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from business_insurance_policy where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.picc.modules.business.entity.InsurancePolicy">
+        update business_insurance_policy
+        <set>
+            <if test="status!=null">
+                status_=#{status,jdbcType=VARCHAR},
+            </if>
+            <if test="processStatus!=null">
+                process_status=#{processStatus,jdbcType=VARCHAR},
+            </if>
+            <if test="insuranceFee!=null">
+                insurance_fee=#{insuranceFee,jdbcType= NUMERIC },
+            </if>
+            <if test="startTime!=null">
+                start_time=#{startTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="endTime!=null">
+                end_time=#{endTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="number!=null">
+                number_=#{number,jdbcType= NUMERIC },
+            </if>
+            <if test="accountBank!=null">
+                account_bank=#{accountBank,jdbcType=VARCHAR},
+            </if>
+            <if test="issuingBank!=null">
+                issuing_bank=#{issuingBank,jdbcType=VARCHAR},
+            </if>
+            <if test="singlNumber!=null">
+                singl_number=#{singlNumber,jdbcType=VARCHAR},
+            </if>
+            <if test="transferTime!=null">
+                transfer_time=#{transferTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="agentId!=null">
+                agent_id=#{agentId,jdbcType=VARCHAR},
+            </if>
+            <if test="insurancePolicyFile!=null">
+                insurance_policy_file=#{insurancePolicyFile,jdbcType=VARCHAR},
+            </if>
+            <if test="no!=null">
+                no_=#{no,jdbcType= NUMERIC },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="InsurancePolicyMap">
+        select
+        id_,status_,process_status,insurance_fee,start_time,end_time,number_,account_bank,issuing_bank,singl_number,transfer_time,agent_id,insurance_policy_file,no_,del_flag,create_by,create_time,update_by,update_time		from business_insurance_policy where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from business_insurance_policy where id_=#{0} and del_flag = false
+    </select>
+    <select id="list" resultMap="InsurancePolicyMap">
+        select * from business_insurance_policy where del_flag = false
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="InsurancePolicyMap">
+        <![CDATA[
+			SELECT a.* FROM business_insurance_policy a LEFT JOIN business_application_policy b ON a.id_ = b.policy_id
 		]]>
-		<where>
-			and del_flag = false
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
-			</if>
-		</where>
-		<foreach item="sort" collection="sortList"  open="order by" separator=",">
-	        ${sort.name} ${sort.order}
-	 	</foreach>
-	</select>
+        <where>
+            <if test="searchParams.delFlag != null">
+                and a.del_flag = #{searchParams.delFlag}
+            </if>
+            <if test="searchParams.applicationId != null">
+                and b.application_id like #{searchParams.applicationId}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList"  open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
 </mapper>

+ 112 - 0
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/InsurancePolicyController.java

@@ -1,9 +1,121 @@
 package com.jpsoft.picc.modules.auth.controller;
 
+import com.github.pagehelper.Page;
+import com.jpsoft.picc.modules.business.entity.InsurancePolicy;
+import com.jpsoft.picc.modules.business.service.InsurancePolicyService;
+import com.jpsoft.picc.modules.common.dto.MessageResult;
+import com.jpsoft.picc.modules.common.dto.Sort;
+import com.jpsoft.picc.modules.common.utils.PojoUtils;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Api(description="每月投保单")
 @RestController
 public class InsurancePolicyController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private InsurancePolicyService insurancePolicyService;
+
+    @ApiOperation(value="每月投保单列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "applicationId",value = "投保申请ID", required = true, paramType = "form",dataType = "String")
+    })
+    public MessageResult<Map> pageList(
+            @RequestParam(value="applicationId",defaultValue="") String applicationId,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize){
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        searchParams.put("delFlag",false);
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("id_","asc"));
+
+        if (StringUtils.isNotEmpty(applicationId)) {
+            searchParams.put("applicationId",applicationId);
+        }
+
+        Page<InsurancePolicy> page = insurancePolicyService.pageSearch(searchParams,pageIndex,pageSize,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="每月投保单详情")
+    @RequestMapping(value = "detail",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String")
+    })
+    public MessageResult<InsurancePolicy> detail(@RequestParam(value="id",defaultValue="") String id){
+        MessageResult<InsurancePolicy> msgResult = new MessageResult<>();
+
+        try {
+            InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
+
+            if (insurancePolicy != null) {
+                msgResult.setResult(true);
+                msgResult.setData(insurancePolicy);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="查看退回理由")
+    @RequestMapping(value = "backReason",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String")
+    })
+    public MessageResult<String> backReason(@RequestParam(value="id",defaultValue="") String id){
+        MessageResult<String> msgResult = new MessageResult<>();
+
+        try {
+            InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
+
+            if (insurancePolicy != null) {
+                msgResult.setResult(true);
+                msgResult.setData("aaa");
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }