Browse Source

阿米巴付款申请开发

anderx 3 years ago
parent
commit
be50448239

+ 39 - 0
src/main/java/com/goafanti/ambSystem/bo/InputAmbPayment.java

@@ -0,0 +1,39 @@
+package com.goafanti.ambSystem.bo;
+
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.model.AmbPaymentApplication;
+import com.goafanti.common.utils.Param;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+public class InputAmbPayment extends AmbPaymentApplication {
+
+    @Param(name="付款类型")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private Integer type;
+
+    @Param(name="付款金额")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private BigDecimal totalAmount;
+
+    @Override
+    public Integer getType() {
+        return type;
+    }
+
+    @Override
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    @Override
+    public BigDecimal getTotalAmount() {
+        return totalAmount;
+    }
+
+    @Override
+    public void setTotalAmount(BigDecimal totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+}

+ 30 - 0
src/main/java/com/goafanti/ambSystem/controller/AmbApiController.java

@@ -20,6 +20,12 @@ public class AmbApiController extends CertifyApiController {
 	@Autowired
 	private AmbService ambService;
 
+	/**
+	 * 新增巴
+	 * @param in
+	 * @param bindingResult
+	 * @return
+	 */
 	@RequestMapping(value="/add",method = RequestMethod.POST)
 	public Result addAmb(@Validated InputAmb in,BindingResult bindingResult){
 		Result res =new Result();
@@ -37,6 +43,11 @@ public class AmbApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 修改巴
+	 * @param in
+	 * @return
+	 */
 	@RequestMapping(value="/update",method = RequestMethod.POST)
 	public Result updateAmb( InputAmb in){
 		Result res =new Result();
@@ -48,6 +59,11 @@ public class AmbApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 删除巴
+	 * @param in
+	 * @return
+	 */
 	@RequestMapping(value="/delete",method = RequestMethod.POST)
 	public Result deleteAmb( InputAmb in){
 		Result res =new Result();
@@ -64,6 +80,11 @@ public class AmbApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 巴详情
+	 * @param in
+	 * @return
+	 */
 	@RequestMapping(value="/details",method = RequestMethod.GET)
 	public Result detailsAmb( InputAmb in){
 		Result res =new Result();
@@ -75,6 +96,11 @@ public class AmbApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 巴列表
+	 * @param in
+	 * @return
+	 */
 	@RequestMapping(value="/select",method = RequestMethod.GET)
 	public Result selectAmb( InputAmb in){
 		Result res =new Result();
@@ -82,6 +108,10 @@ public class AmbApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 下拉把列表
+	 * @return
+	 */
 	@RequestMapping(value="/selectAll",method = RequestMethod.GET)
 	public Result selectAll( ){
 		Result res =new Result();

+ 100 - 0
src/main/java/com/goafanti/ambSystem/controller/AmbPaymentApiController.java

@@ -0,0 +1,100 @@
+package com.goafanti.ambSystem.controller;
+
+import com.goafanti.ambSystem.bo.InputAmb;
+import com.goafanti.ambSystem.bo.InputAmbPayment;
+import com.goafanti.ambSystem.service.AmbPaymentService;
+import com.goafanti.ambSystem.service.AmbService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.utils.ParamUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@RestController
+@RequestMapping(value = "/api/admin/ambPayment")
+public class AmbPaymentApiController extends CertifyApiController {
+	@Autowired
+	private AmbPaymentService ambPaymentService;
+
+	/**
+	 * 新增巴付款
+	 * @param in
+	 * @param bindingResult
+	 * @return
+	 */
+	@RequestMapping(value="/add",method = RequestMethod.POST)
+	public Result addAmb(@Validated InputAmbPayment in, BindingResult bindingResult){
+		Result res =new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
+			return res;
+		}
+		int i=ambPaymentService.checkAmbPayment(in);
+		if (i==-1){
+			res.getError().add(buildError(String.format("[%s]已存在,请确认后再新增",in.getName())));
+			return res;
+		}
+		res.data(ambService.addAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/update",method = RequestMethod.POST)
+	public Result updateAmb( InputAmb in){
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+			return res;
+		}
+		res.data(ambService.updateAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/delete",method = RequestMethod.POST)
+	public Result deleteAmb( InputAmb in){
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+			return res;
+		}
+		int i=ambService.checkAmb(in,2);
+		if (i==-1){
+			res.getError().add(buildError("巴存在子项目,请先删除所有子项"));
+			return res;
+		}
+		res.data(ambService.deleteAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/details",method = RequestMethod.GET)
+	public Result detailsAmb( InputAmb in){
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+			return res;
+		}
+		res.data(ambService.detailsAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/select",method = RequestMethod.GET)
+	public Result selectAmb( InputAmb in){
+		Result res =new Result();
+		res.data(ambService.selectAmb(in));
+		return res;
+	}
+
+	@RequestMapping(value="/selectAll",method = RequestMethod.GET)
+	public Result selectAll( ){
+		Result res =new Result();
+		res.data(ambService.selectAll());
+		return res;
+	}
+
+}

+ 7 - 0
src/main/java/com/goafanti/ambSystem/service/AmbPaymentService.java

@@ -0,0 +1,7 @@
+package com.goafanti.ambSystem.service;
+
+import com.goafanti.ambSystem.bo.InputAmbPayment;
+
+public interface AmbPaymentService {
+    int checkAmbPayment(InputAmbPayment in);
+}

+ 23 - 0
src/main/java/com/goafanti/ambSystem/service/Impl/AmbPaymentServiceImpl.java

@@ -0,0 +1,23 @@
+package com.goafanti.ambSystem.service.Impl;
+
+import com.goafanti.ambSystem.bo.InputAmbPayment;
+import com.goafanti.ambSystem.service.AmbPaymentService;
+import com.goafanti.common.dao.AmbPaymentApplicationMapper;
+import com.goafanti.common.dao.AmbSystemMapper;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AmbPaymentServiceImpl extends BaseMybatisDao<AmbPaymentApplicationMapper> implements AmbPaymentService {
+    @Autowired
+    private AmbPaymentApplicationMapper ambPaymentApplicationMapper;
+    @Autowired
+    private AmbSystemMapper ambSystemMapper;
+
+    @Override
+    public int checkAmbPayment(InputAmbPayment in) {
+
+        return 0;
+    }
+}

+ 17 - 4
src/main/java/com/goafanti/common/mapper/AmbPaymentApplicationMapper.xml

@@ -14,10 +14,11 @@
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
     <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="payment_amb_id" jdbcType="VARCHAR" property="paymentAmbId" />
   </resultMap>
   <sql id="Base_Column_List">
     id, `type`, total_amount, content, remarks, annex_url, process_status, `status`, 
-    create_by, create_time, update_by, update_time
+    create_by, create_time, update_by, update_time, payment_amb_id
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select 
@@ -33,11 +34,13 @@
     insert into amb_payment_application (`type`, total_amount, content, 
       remarks, annex_url, process_status, 
       `status`, create_by, create_time, 
-      update_by, update_time)
+      update_by, update_time, payment_amb_id
+      )
     values (#{type,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR}, 
       #{remarks,jdbcType=VARCHAR}, #{annexUrl,jdbcType=VARCHAR}, #{processStatus,jdbcType=INTEGER}, 
       #{status,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP})
+      #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{paymentAmbId,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbPaymentApplication" useGeneratedKeys="true">
     insert into amb_payment_application
@@ -75,6 +78,9 @@
       <if test="updateTime != null">
         update_time,
       </if>
+      <if test="paymentAmbId != null">
+        payment_amb_id,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="type != null">
@@ -110,6 +116,9 @@
       <if test="updateTime != null">
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="paymentAmbId != null">
+        #{paymentAmbId,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbPaymentApplication">
@@ -148,6 +157,9 @@
       <if test="updateTime != null">
         update_time = #{updateTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="paymentAmbId != null">
+        payment_amb_id = #{paymentAmbId,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -163,7 +175,8 @@
       create_by = #{createBy,jdbcType=VARCHAR},
       create_time = #{createTime,jdbcType=TIMESTAMP},
       update_by = #{updateBy,jdbcType=VARCHAR},
-      update_time = #{updateTime,jdbcType=TIMESTAMP}
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
+      payment_amb_id = #{paymentAmbId,jdbcType=VARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
 </mapper>

+ 13 - 0
src/main/java/com/goafanti/common/model/AmbPaymentApplication.java

@@ -66,6 +66,11 @@ public class AmbPaymentApplication implements Serializable {
      */
     private Date updateTime;
 
+    /**
+     * 付款巴编号
+     */
+    private String paymentAmbId;
+
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -163,4 +168,12 @@ public class AmbPaymentApplication implements Serializable {
     public void setUpdateTime(Date updateTime) {
         this.updateTime = updateTime;
     }
+
+    public String getPaymentAmbId() {
+        return paymentAmbId;
+    }
+
+    public void setPaymentAmbId(String paymentAmbId) {
+        this.paymentAmbId = paymentAmbId;
+    }
 }