Browse Source

阿米巴发起划拨开发

anderx 3 years ago
parent
commit
cfbe4e5d5b

+ 22 - 0
src/main/java/com/goafanti/ambSystem/bo/InputInvestList.java

@@ -0,0 +1,22 @@
+package com.goafanti.ambSystem.bo;
+
+public class InputInvestList {
+    private Integer pageSize;
+    private Integer pageNo;
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+}

+ 78 - 0
src/main/java/com/goafanti/ambSystem/bo/OutInvestList.java

@@ -0,0 +1,78 @@
+package com.goafanti.ambSystem.bo;
+
+import java.math.BigDecimal;
+
+public class OutInvestList {
+    private Long id;
+    private String initiateName;
+    private String acceptName;
+    private BigDecimal amount;
+    private Integer status;
+    private String operator;
+    private String comment;
+    private String createTimes;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getInitiateName() {
+        return initiateName;
+    }
+
+    public void setInitiateName(String initiateName) {
+        this.initiateName = initiateName;
+    }
+
+    public String getAcceptName() {
+        return acceptName;
+    }
+
+    public void setAcceptName(String acceptName) {
+        this.acceptName = acceptName;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+}

+ 69 - 0
src/main/java/com/goafanti/ambSystem/bo/OutInvestLog.java

@@ -0,0 +1,69 @@
+package com.goafanti.ambSystem.bo;
+
+import java.math.BigDecimal;
+
+public class OutInvestLog {
+    private Long id;
+    private Long ambInvestId;
+    private BigDecimal amount;
+    private Integer status;
+    private String comment;
+    private String operator;
+    private String createTimes;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getAmbInvestId() {
+        return ambInvestId;
+    }
+
+    public void setAmbInvestId(Long ambInvestId) {
+        this.ambInvestId = ambInvestId;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+}

+ 23 - 0
src/main/java/com/goafanti/ambSystem/controller/AmbInvestApiController.java

@@ -2,6 +2,7 @@ package com.goafanti.ambSystem.controller;
 
 import com.goafanti.ambSystem.bo.InputAmb;
 import com.goafanti.ambSystem.bo.InputAmbInvest;
+import com.goafanti.ambSystem.bo.InputInvestList;
 import com.goafanti.ambSystem.service.AmbInvestService;
 import com.goafanti.ambSystem.service.AmbService;
 import com.goafanti.common.bo.Result;
@@ -54,4 +55,26 @@ public class AmbInvestApiController extends CertifyApiController {
 	}
 
 
+	/**
+	 * 划拨列表
+	 * @return
+	 */
+	@RequestMapping(value="/InvestList",method = RequestMethod.GET)
+	public Result InvestList(InputInvestList in){
+		Result res =new Result();
+		res.data(ambInvestService.InvestList(in));
+		return res;
+	}
+
+	/**
+	 * 划拨日志
+	 * @return
+	 */
+	@RequestMapping(value="/InvestLog",method = RequestMethod.GET)
+	public Result InvestLog(String id){
+		Result res =new Result();
+		res.data(ambInvestService.InvestLog(id));
+		return res;
+	}
+
 }

+ 9 - 0
src/main/java/com/goafanti/ambSystem/service/AmbInvestService.java

@@ -1,9 +1,18 @@
 package com.goafanti.ambSystem.service;
 
 import com.goafanti.ambSystem.bo.InputAmbInvest;
+import com.goafanti.ambSystem.bo.InputInvestList;
+import com.goafanti.ambSystem.bo.OutInvestLog;
+import com.goafanti.core.mybatis.page.Pagination;
+
+import java.util.List;
 
 public interface AmbInvestService {
     int pushInvestTransfer(InputAmbInvest in);
 
     boolean checkMyAmb(Long myAmbId);
+
+    Pagination<?> InvestList(InputInvestList in);
+
+    List<OutInvestLog> InvestLog(String id);
 }

+ 30 - 1
src/main/java/com/goafanti/ambSystem/service/Impl/AmbInvestServiceImpl.java

@@ -1,20 +1,30 @@
 package com.goafanti.ambSystem.service.Impl;
 
 import com.goafanti.ambSystem.bo.InputAmbInvest;
+import com.goafanti.ambSystem.bo.InputInvestList;
+import com.goafanti.ambSystem.bo.OutInvestLog;
 import com.goafanti.ambSystem.service.AmbInvestService;
-import com.goafanti.ambSystem.service.AmbPaymentService;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.AmbInvestLogMapper;
 import com.goafanti.common.dao.AmbInvestMapper;
 import com.goafanti.common.dao.AmbSystemMapper;
+import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.model.AmbInvest;
 import com.goafanti.common.model.AmbInvestLog;
 import com.goafanti.common.model.AmbSystem;
+import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.print.attribute.standard.MediaSize;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Service
 public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implements AmbInvestService {
     @Autowired
@@ -23,12 +33,15 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
     private AmbInvestMapper ambInvestMapper;
     @Autowired
     private AmbInvestLogMapper ambInvestLogMapper;
+    @Autowired
+    private AsyncUtils asyncUtils;
 
 
 
     @Override
     @Transactional
     public int pushInvestTransfer(InputAmbInvest in) {
+        AmbSystem other=ambSystemMapper.selectByPrimaryKey(in.getOtherAmbId());
         AmbInvest ambInvest=new AmbInvest();
         ambInvest.setInitiateAmbId(in.getMyAmbId());
         ambInvest.setAcceptAmbId(in.getOtherAmbId());
@@ -43,6 +56,7 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
         log.setOperator(TokenManager.getAdminId());
         log.setStatus(1);
         ambInvestLogMapper.insertSelective(log);
+        asyncUtils.addNoticAndEmail(other.getAccountant(), NoticeStatus.AMB_INVEST_START.getCode(),"阿米巴" );
         return 1;
     }
 
@@ -54,4 +68,19 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
         }
         return false;
     }
+
+    @Override
+    public Pagination<?> InvestList(InputInvestList in) {
+        Map<String,Object> params=new HashMap<>();
+        if (TokenManager.hasRole(AFTConstants.FINANCE_ADMIN)){
+            params.put("roleType",1);
+        }
+
+        return findPage("selectInvestList","selectInvestCount",params,in.getPageNo(),in.getPageSize());
+    }
+
+    @Override
+    public List<OutInvestLog> InvestLog(String id) {
+        return ambInvestLogMapper.selectByAmbInvestId(id);
+    }
 }

+ 6 - 1
src/main/java/com/goafanti/common/dao/AmbInvestLogMapper.java

@@ -1,7 +1,10 @@
 package com.goafanti.common.dao;
 
+import com.goafanti.ambSystem.bo.OutInvestLog;
 import com.goafanti.common.model.AmbInvestLog;
 
+import java.util.List;
+
 public interface AmbInvestLogMapper {
     int deleteByPrimaryKey(Long id);
 
@@ -14,4 +17,6 @@ public interface AmbInvestLogMapper {
     int updateByPrimaryKeySelective(AmbInvestLog record);
 
     int updateByPrimaryKey(AmbInvestLog record);
-}
+
+    List<OutInvestLog> selectByAmbInvestId(String id);
+}

+ 3 - 0
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -75,6 +75,9 @@ public enum NoticeStatus {
 	PROJECT_RENEW_START(66,"项目重启流程发起"),
 	PROJECT_RENEW_YES(67,"项目重启流程通过"),
 	PROJECT_RENEW_NO(68,"项目重启流程拒绝"),
+	AMB_INVEST_START(69,"阿米巴划拨发起"),
+	AMB_INVEST_YES(70,"阿米巴划拨通过"),
+	AMB_INVEST_NO(71,"阿米巴划拨拒绝"),
 	OTHER(0, "其他");
 
 	private NoticeStatus(Integer code, String desc) {

+ 29 - 8
src/main/java/com/goafanti/common/mapper/AmbInvestLogMapper.xml

@@ -8,25 +8,29 @@
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="comment" jdbcType="VARCHAR" property="comment" />
     <result column="operator" jdbcType="VARCHAR" property="operator" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, amb_invest_id, amount, `status`, `comment`, `operator`
+    id, amb_invest_id, amount, `status`, `comment`, `operator`, create_time
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from amb_invest_log
     where id = #{id,jdbcType=BIGINT}
   </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from amb_invest_log
     where id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvestLog" useGeneratedKeys="true">
-    insert into amb_invest_log (amb_invest_id, amount, `status`, 
-      `comment`, `operator`)
-    values (#{ambInvestId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, 
-      #{comment,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR})
+    insert into amb_invest_log (amb_invest_id, amount, `status`,
+      `comment`, `operator`, create_time
+      )
+    values (#{ambInvestId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER},
+      #{comment,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvestLog" useGeneratedKeys="true">
     insert into amb_invest_log
@@ -46,6 +50,9 @@
       <if test="operator != null">
         `operator`,
       </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="ambInvestId != null">
@@ -63,6 +70,9 @@
       <if test="operator != null">
         #{operator,jdbcType=VARCHAR},
       </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbInvestLog">
@@ -83,6 +93,9 @@
       <if test="operator != null">
         `operator` = #{operator,jdbcType=VARCHAR},
       </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -92,7 +105,15 @@
       amount = #{amount,jdbcType=DECIMAL},
       `status` = #{status,jdbcType=INTEGER},
       `comment` = #{comment,jdbcType=VARCHAR},
-      `operator` = #{operator,jdbcType=VARCHAR}
+      `operator` = #{operator,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}
   </update>
-</mapper>
+
+  <select id="selectByAmbInvestId" resultType="com.goafanti.ambSystem.bo.OutInvestLog">
+    select a.id ,a.amb_invest_id ambInvestId ,a.status ,a.comment ,b.name operator,
+           date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes
+    from amb_invest_log a  left join admin b on a.operator =b.id
+    where amb_invest_id = #{id}
+  </select>
+</mapper>

+ 46 - 10
src/main/java/com/goafanti/common/mapper/AmbInvestMapper.xml

@@ -9,12 +9,13 @@
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="operator" jdbcType="VARCHAR" property="operator" />
     <result column="comment" jdbcType="VARCHAR" property="comment" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, initiate_amb_id, accept_amb_id, amount, `status`, `operator`, `comment`
+    id, initiate_amb_id, accept_amb_id, amount, `status`, `operator`, `comment`, create_time
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from amb_invest
     where id = #{id,jdbcType=BIGINT}
@@ -24,12 +25,12 @@
     where id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvest" useGeneratedKeys="true">
-    insert into amb_invest (initiate_amb_id, accept_amb_id, amount, 
-      `status`, `operator`, `comment`
-      )
-    values (#{initiateAmbId,jdbcType=BIGINT}, #{acceptAmbId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL}, 
-      #{status,jdbcType=INTEGER}, #{operator,jdbcType=VARCHAR}, #{comment,jdbcType=VARCHAR}
-      )
+    insert into amb_invest (initiate_amb_id, accept_amb_id, amount,
+      `status`, `operator`, `comment`,
+      create_time)
+    values (#{initiateAmbId,jdbcType=BIGINT}, #{acceptAmbId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL},
+      #{status,jdbcType=INTEGER}, #{operator,jdbcType=VARCHAR}, #{comment,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvest" useGeneratedKeys="true">
     insert into amb_invest
@@ -52,6 +53,9 @@
       <if test="comment != null">
         `comment`,
       </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="initiateAmbId != null">
@@ -72,6 +76,9 @@
       <if test="comment != null">
         #{comment,jdbcType=VARCHAR},
       </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbInvest">
@@ -95,6 +102,9 @@
       <if test="comment != null">
         `comment` = #{comment,jdbcType=VARCHAR},
       </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -105,7 +115,33 @@
       amount = #{amount,jdbcType=DECIMAL},
       `status` = #{status,jdbcType=INTEGER},
       `operator` = #{operator,jdbcType=VARCHAR},
-      `comment` = #{comment,jdbcType=VARCHAR}
+      `comment` = #{comment,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}
   </update>
-</mapper>
+
+  <select id="selectInvestList" resultType="com.goafanti.ambSystem.bo.OutInvestList">
+    select a.id,b.name initiateName,c.name acceptName,a.amount ,a.status ,d.name operator,a.comment ,
+    date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes
+    from amb_invest a  left join amb_system b on a.initiate_amb_id =b.id
+    left join amb_system c on a.accept_amb_id =c.id
+    left join admin d on a.operator =d.id
+    where 1=1
+    <if test="roleType==1">
+      and a.status in (1,2,3)
+    </if>
+    order by a.create_time desc
+    <if test="page_sql !=null">
+      ${page_sql}
+    </if>
+  </select>
+
+  <select id="selectInvestCount" resultType="integer">
+    select count(*)
+    from amb_invest a
+    where 1=1
+    <if test="roleType==1">
+      and a.status in (1,2,3)
+    </if>
+  </select>
+</mapper>

+ 14 - 0
src/main/java/com/goafanti/common/model/AmbInvest.java

@@ -2,6 +2,7 @@ package com.goafanti.common.model;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * amb_invest
@@ -40,6 +41,11 @@ public class AmbInvest implements Serializable {
      */
     private String comment;
 
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -97,4 +103,12 @@ public class AmbInvest implements Serializable {
     public void setComment(String comment) {
         this.comment = comment;
     }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
 }

+ 14 - 0
src/main/java/com/goafanti/common/model/AmbInvestLog.java

@@ -2,6 +2,7 @@ package com.goafanti.common.model;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * amb_invest_log
@@ -32,6 +33,11 @@ public class AmbInvestLog implements Serializable {
      */
     private String operator;
 
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -81,4 +87,12 @@ public class AmbInvestLog implements Serializable {
     public void setOperator(String operator) {
         this.operator = operator;
     }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
 }

+ 17 - 0
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -88,6 +88,23 @@ public class AsyncUtils {
 		send(bo);
 	}
 
+	/**
+	 *
+	 * @param aid 通知对象
+	 * @param noticeType  通知类型
+	 * @param content 通知内容
+	 */
+	public void addNoticAndEmail(String aid,Integer noticeType,String content) {
+		Notice n=new Notice();
+		n.setId(UUID.randomUUID().toString());
+		n.setAid(aid);
+		n.setNoticeType(noticeType);
+		n.setContent(content);
+		n.setReaded(0);
+		n.setType(NoticeTypes.getType(n.getNoticeType()));
+		addNoticAndEmail(n);
+	}
+
 
 	public void addNoticeBatch(List<Notice> ln) {
 		List<Notice> newList=new ArrayList<Notice>();