Explorar el Código

状态翻译等

xiao547607 hace 5 años
padre
commit
b8f2e8a7da

+ 108 - 1
picc-admin-server/src/main/java/com/jpsoft/picc/modules/business/controller/StudentApplicationController.java

@@ -1,6 +1,8 @@
 package com.jpsoft.picc.modules.business.controller;
 
 import com.github.pagehelper.Page;
+import com.jpsoft.picc.modules.base.entity.InsuranceDefinition;
+import com.jpsoft.picc.modules.base.service.InsuranceDefinitionService;
 import com.jpsoft.picc.modules.business.entity.StudentApplication;
 import com.jpsoft.picc.modules.business.service.StudentApplicationService;
 import com.jpsoft.picc.modules.common.dto.Sort;
@@ -11,10 +13,13 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -27,6 +32,9 @@ public class StudentApplicationController {
     @Autowired
     private StudentApplicationService studentApplicationService;
 
+    @Autowired
+    private InsuranceDefinitionService insuranceDefinitionService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<StudentApplication> create(){
@@ -209,12 +217,13 @@ public class StudentApplicationController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("a.create_time","desc"));
 
         if (StringUtils.isNotEmpty(id)) {
             searchParams.put("id","%" + id + "%");
         }
 
+        searchParams.put("delFlag",false);
         Page<StudentApplication> page = studentApplicationService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
         msgResult.setResult(true);
@@ -222,4 +231,102 @@ public class StudentApplicationController {
 
         return msgResult;
     }
+
+
+    @ApiOperation(value="添加测试信息")
+    @PostMapping("addTestApplication")
+    public MessageResult<StudentApplication> addTestApplication(
+            String type,
+            @RequestAttribute String subject){
+        MessageResult<StudentApplication> msgResult = new MessageResult<>();
+
+        try {
+            StudentApplication studentApplication = new StudentApplication();
+            studentApplication.setId(UUID.randomUUID().toString());
+            studentApplication.setDelFlag(false);
+            studentApplication.setCreateBy(subject);
+            studentApplication.setCreateTime(new Date());
+
+            //学平险 fa84df46-1d38-4aa7-ae15-4c8b28c467ed
+            //学平险+监护人责任险 b318c3ac-c460-4d93-aa92-78b57efba125
+            if("1".equals(type)){
+                studentApplication.setDefinitionId("fa84df46-1d38-4aa7-ae15-4c8b28c467ed");
+            }else {
+                studentApplication.setDefinitionId("b318c3ac-c460-4d93-aa92-78b57efba125");
+            }
+            DateTime createTime = new DateTime(new Date());
+            //投保单号
+            studentApplication.setPolicyNo(createTime.toString("yyyyMMddHHmmssSSS"));
+            //投保人ID insured_id
+            //投保人姓名 insured_name
+            if("1".equals(type)){
+                studentApplication.setInsuredName("舒展");
+            }else {
+                studentApplication.setInsuredName("舒展监护人责任险");
+            }
+            //投保人证件号码 insured_card
+            studentApplication.setInsuredCard("421002199101141033");
+            //投保人联系电话 insured_tel
+            studentApplication.setInsuredTel("13437120102");
+            //是否有附加险 have_attach
+
+            if("1".equals(type)){
+                studentApplication.setHaveAttach(false);
+            }else {
+                studentApplication.setHaveAttach(true);
+                //附加险投保人ID attach_id
+                //附加险投保人姓名 attach_name
+                studentApplication.setAttachName("舒爸爸");
+                //附加险投保人证件号码 attach_card
+                studentApplication.setAttachCard("421002198101141033");
+                //附加险投保人联系电话 attach_tel
+                studentApplication.setAttachTel("13476980773");
+            }
+            //有无医保 have_medicare
+            studentApplication.setHaveMedicare(true);
+            DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+            //保障开始时间 start_time
+            studentApplication.setStartTime(format.parse("2020-08-01"));
+            //保障结束时间 end_time
+            studentApplication.setEndTime(format.parse("2020-09-01"));
+            //保险费合计(总金额) insurance_fee
+            if("1".equals(type)){
+                studentApplication.setInsuranceFee(new BigDecimal(100));
+            }else {
+                studentApplication.setInsuranceFee(new BigDecimal(120));
+            }
+            //状态:待缴费20/待审核30/待制单40/待签名50/已出单60/已过期100 status_
+            studentApplication.setStatus("30");
+            //流程审核状态:正常/回退等 process_status
+            studentApplication.setProcessStatus("正常");
+            //出单时间 finish_time
+            //studentApplication.setFinishTime(new Date());
+            //电子签名 signature_
+            studentApplication.setSignature("");
+            //电子签名2 signature_2
+            studentApplication.setSignature2("");
+            //电子签名3 signature_3
+            studentApplication.setSignature3("");
+            //支付订单号 payment_order
+            studentApplication.setPaymentOrder("000000009");
+
+            int affectCount = studentApplicationService.insert(studentApplication);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(studentApplication);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }

+ 53 - 9
picc-common/src/main/java/com/jpsoft/picc/modules/business/entity/StudentApplication.java

@@ -4,6 +4,9 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
+
+import com.jpsoft.picc.modules.common.constant.PolicyStatus;
+import com.jpsoft.picc.modules.common.constant.StudentPolicyStatus;
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -41,8 +44,8 @@ public class StudentApplication {
 	/**
 	 *更新时间
 	 */
-	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
 	@ApiModelProperty(value = "更新时间")
 	private Date updateTime;
 	/**
@@ -55,6 +58,8 @@ public class StudentApplication {
 	 */
 	@ApiModelProperty(value = "保险种类")
 	private String definitionId;
+	@ApiModelProperty(value = "险种名称")
+	private String definitionName;
 	/**
 	 *投保单号
 	 */
@@ -113,15 +118,15 @@ public class StudentApplication {
 	/**
 	 *保障开始时间
 	 */
-	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
 	@ApiModelProperty(value = "保障开始时间")
 	private Date startTime;
 	/**
 	 *保障结束时间
 	 */
-	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
 	@ApiModelProperty(value = "保障结束时间")
 	private Date endTime;
 	/**
@@ -130,10 +135,12 @@ public class StudentApplication {
 	@ApiModelProperty(value = "保险费合计(总金额)")
 	private BigDecimal insuranceFee;
 	/**
-	 *状态:待缴费20/待制单30/待出单40/待签名50/已出单60/已过期100
+	 *状态:待缴费20/待审核30/待制单40/待签名50/已出单60/已过期100
 	 */
-	@ApiModelProperty(value = "状态:待缴费20/待制单30/待出单40/待签名50/已出单60/已过期100")
+	@ApiModelProperty(value = "状态:待缴费20/待审核30/待制单40/待签名50/已出单60/已过期100")
 	private String status;
+	@ApiModelProperty(value = "状态:待缴费20/待审核30/待制单40/待签名50/已出单60/已过期100(翻译)")
+	private String statusN;
 	/**
 	 *流程审核状态:正常/回退等
 	 */
@@ -142,7 +149,7 @@ public class StudentApplication {
 	/**
 	 *出单时间
 	 */
-	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
 	@ApiModelProperty(value = "出单时间")
 	private Date finishTime;
@@ -166,4 +173,41 @@ public class StudentApplication {
 	 */
 	@ApiModelProperty(value = "支付订单号")
 	private String paymentOrder;
+
+	/**
+	 * 状态翻译
+	 * @return
+	 */
+	public String getStatusN() {
+		String statusN = "";
+		if(status.equals("10")){
+			statusN = StudentPolicyStatus.Draft.getText();
+		}
+		else if(status.equals("15")){
+			statusN = StudentPolicyStatus.Back.getText();
+		}
+		else if(status.equals("20")){
+			statusN = StudentPolicyStatus.PendingPay.getText();
+		}
+		else if(status.equals("30")){
+			statusN = StudentPolicyStatus.PendingMakePolicy.getText();
+		}
+		else if(status.equals("40")){
+			statusN = StudentPolicyStatus.PendingOutPolicy.getText();
+		}
+		else if(status.equals("50")){
+			statusN = StudentPolicyStatus.PendingSigned.getText();
+		}
+		else if(status.equals("60")){
+			statusN = StudentPolicyStatus.SendOutPolicy.getText();
+		}
+		else{
+			statusN = StudentPolicyStatus.Expired.getText();
+		}
+		return statusN;
+	}
+
+	public void setStatusN(String statusN){
+		this.statusN = statusN;
+	}
 }

+ 48 - 0
picc-common/src/main/java/com/jpsoft/picc/modules/common/constant/StudentPolicyStatus.java

@@ -0,0 +1,48 @@
+package com.jpsoft.picc.modules.common.constant;
+
+/**
+ * 投保单状态
+ */
+public enum StudentPolicyStatus {
+    Draft("草稿",10),
+    Back("材料不齐",15),
+    PendingPay("待缴费",20),
+    PendingMakePolicy("待制单",30),
+    PendingOutPolicy("待出单",40),
+    PendingSigned("待签名",50),
+    SendOutPolicy("已出单",60),
+    Expired("已过期",100);
+
+    private int value;
+    private String text;
+
+    StudentPolicyStatus(String text, int value){
+        this.text = text;
+        this.value = value;
+    }
+
+    public static StudentPolicyStatus valueOf(int value){
+        for (StudentPolicyStatus policyStatus : StudentPolicyStatus.values()) {
+            if (policyStatus.getValue()==value){
+                return policyStatus;
+            }
+        }
+
+        return null;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }}

+ 36 - 30
picc-common/src/main/resources/mapper/business/StudentApplication.xml

@@ -11,6 +11,7 @@
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
 			<result property="definitionId" column="definition_id" />
+			<result property="definitionName" column="definition_name"/>
 			<result property="policyNo" column="policy_no" />
 			<result property="insuredId" column="insured_id" />
 			<result property="insuredName" column="insured_name" />
@@ -44,34 +45,34 @@
 	    (id_,create_by,create_time,update_by,update_time,del_flag,definition_id,policy_no,insured_id,insured_name,insured_card,insured_tel,have_attach,attach_id,attach_name,attach_card,attach_tel,have_medicare,start_time,end_time,insurance_fee,status_,process_status,finish_time,signature_,signature_2,signature_3,payment_order)
 		values
 		(
-#{id,jdbcType=VARCHAR}
-,#{createBy,jdbcType=VARCHAR}
-,#{createTime,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateTime,jdbcType= TIMESTAMP }
-,#{delFlag,jdbcType= NUMERIC }
-,#{definitionId,jdbcType=VARCHAR}
-,#{policyNo,jdbcType=VARCHAR}
-,#{insuredId,jdbcType=VARCHAR}
-,#{insuredName,jdbcType=VARCHAR}
-,#{insuredCard,jdbcType=VARCHAR}
-,#{insuredTel,jdbcType=VARCHAR}
-,#{haveAttach,jdbcType= NUMERIC }
-,#{attachId,jdbcType=VARCHAR}
-,#{attachName,jdbcType=VARCHAR}
-,#{attachCard,jdbcType=VARCHAR}
-,#{attachTel,jdbcType=VARCHAR}
-,#{haveMedicare,jdbcType= NUMERIC }
-,#{startTime,jdbcType= TIMESTAMP }
-,#{endTime,jdbcType= TIMESTAMP }
-,#{insuranceFee,jdbcType= NUMERIC }
-,#{status,jdbcType=VARCHAR}
-,#{processStatus,jdbcType=VARCHAR}
-,#{finishTime,jdbcType= TIMESTAMP }
-,#{signature,jdbcType=VARCHAR}
-,#{signature2,jdbcType=VARCHAR}
-,#{signature3,jdbcType=VARCHAR}
-,#{paymentOrder,jdbcType=VARCHAR}
+			#{id,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{definitionId,jdbcType=VARCHAR}
+			,#{policyNo,jdbcType=VARCHAR}
+			,#{insuredId,jdbcType=VARCHAR}
+			,#{insuredName,jdbcType=VARCHAR}
+			,#{insuredCard,jdbcType=VARCHAR}
+			,#{insuredTel,jdbcType=VARCHAR}
+			,#{haveAttach,jdbcType= NUMERIC }
+			,#{attachId,jdbcType=VARCHAR}
+			,#{attachName,jdbcType=VARCHAR}
+			,#{attachCard,jdbcType=VARCHAR}
+			,#{attachTel,jdbcType=VARCHAR}
+			,#{haveMedicare,jdbcType= NUMERIC }
+			,#{startTime,jdbcType= TIMESTAMP }
+			,#{endTime,jdbcType= TIMESTAMP }
+			,#{insuranceFee,jdbcType= NUMERIC }
+			,#{status,jdbcType=VARCHAR}
+			,#{processStatus,jdbcType=VARCHAR}
+			,#{finishTime,jdbcType= TIMESTAMP }
+			,#{signature,jdbcType=VARCHAR}
+			,#{signature2,jdbcType=VARCHAR}
+			,#{signature3,jdbcType=VARCHAR}
+			,#{paymentOrder,jdbcType=VARCHAR}
 		)
 	]]>
 	</insert>
@@ -176,11 +177,16 @@
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="StudentApplicationMap">
 		<![CDATA[
-			select * from business_student_application
+			select a.*,b.name_ as definition_name
+			from business_student_application a
+			left join base_insurance_definition b on a.definition_id = b.id_
 		]]>
 		<where>
 			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+				and a.ID_ like #{searchParams.id}
+			</if>
+			<if test="searchParams.delFlag != null">
+				and a.del_flag = #{searchParams.delFlag}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">