Browse Source

私有报销帐号修改状态

anderx 2 years ago
parent
commit
3a8546a1a0

+ 6 - 2
src/main/java/com/goafanti/common/controller/BaseController.java

@@ -10,8 +10,10 @@ import java.util.List;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import com.goafanti.common.utils.ParamUtils;
 import com.goafanti.common.utils.RedisUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -19,6 +21,7 @@ import org.springframework.beans.propertyeditors.CustomDateEditor;
 import org.springframework.core.io.support.ResourcePropertySource;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
+import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.WebDataBinder;
 import org.springframework.web.bind.annotation.InitBinder;
 import org.springframework.web.bind.annotation.ModelAttribute;
@@ -102,10 +105,11 @@ public class BaseController {
 		return  new Error(MessageFormat.format( msg, params));
 	}
 
-	protected String getErrorMessage(String key, Object... obj) {
-		return MessageFormat.format(getErrorMessage(key), obj);
+	protected Error buildParamError(T t, BindingResult bindingResult) {
+		return   buildErrorMessageParams(ParamUtils.getParamMsg(t,bindingResult.getFieldError().getField()),ParamUtils.getParamName(t,bindingResult.getFieldError().getField()));
 	}
 
+
 	@InitBinder
 	public void initBinder(WebDataBinder binder) {
 		DateFormat dateFormat = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);

+ 17 - 0
src/main/java/com/goafanti/common/dao/ExpenseAccountMapper.java

@@ -0,0 +1,17 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.ExpenseAccount;
+
+public interface ExpenseAccountMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(ExpenseAccount record);
+
+    int insertSelective(ExpenseAccount record);
+
+    ExpenseAccount selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(ExpenseAccount record);
+
+    int updateByPrimaryKey(ExpenseAccount record);
+}

+ 3 - 0
src/main/java/com/goafanti/common/dao/ExpenseAccountPrivateMapper.java

@@ -2,6 +2,7 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.ExpenseAccountPrivate;
 import com.goafanti.expenseAccount.bo.InputExpenseAccountPrivate;
+import com.goafanti.expenseAccount.bo.OutExpenseAccountPrivate;
 
 public interface ExpenseAccountPrivateMapper {
     int deleteByPrimaryKey(Integer id);
@@ -22,4 +23,6 @@ public interface ExpenseAccountPrivateMapper {
     void updateStatusByAid(InputExpenseAccountPrivate in);
 
     ExpenseAccountPrivate selectByAccount(String accounts);
+
+    OutExpenseAccountPrivate selectById(Integer id);
 }

+ 204 - 0
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -0,0 +1,204 @@
+<?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">
+<mapper namespace="com.goafanti.common.dao.ExpenseAccountMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.ExpenseAccount">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="prid" jdbcType="INTEGER" property="prid" />
+    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="aname" jdbcType="VARCHAR" property="aname" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="type_other" jdbcType="VARCHAR" property="typeOther" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="process_status" jdbcType="INTEGER" property="processStatus" />
+    <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
+    <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
+    <result column="apply_dep" jdbcType="VARCHAR" property="applyDep" />
+    <result column="pay_dep" jdbcType="VARCHAR" property="payDep" />
+    <result column="eaaid" jdbcType="INTEGER" property="eaaid" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, prid, order_no, aid, aname, `type`, type_other, `status`, process_status, total_amount, 
+    attachment_url, apply_dep, pay_dep, eaaid, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from expense_account
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from expense_account
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
+    insert into expense_account (prid, order_no, aid, 
+      aname, `type`, type_other, 
+      `status`, process_status, total_amount, 
+      attachment_url, apply_dep, pay_dep, 
+      eaaid, create_time)
+    values (#{prid,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, 
+      #{aname,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{typeOther,jdbcType=VARCHAR}, 
+      #{status,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL}, 
+      #{attachmentUrl,jdbcType=VARCHAR}, #{applyDep,jdbcType=VARCHAR}, #{payDep,jdbcType=VARCHAR}, 
+      #{eaaid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
+    insert into expense_account
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="prid != null">
+        prid,
+      </if>
+      <if test="orderNo != null">
+        order_no,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="aname != null">
+        aname,
+      </if>
+      <if test="type != null">
+        `type`,
+      </if>
+      <if test="typeOther != null">
+        type_other,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="processStatus != null">
+        process_status,
+      </if>
+      <if test="totalAmount != null">
+        total_amount,
+      </if>
+      <if test="attachmentUrl != null">
+        attachment_url,
+      </if>
+      <if test="applyDep != null">
+        apply_dep,
+      </if>
+      <if test="payDep != null">
+        pay_dep,
+      </if>
+      <if test="eaaid != null">
+        eaaid,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="prid != null">
+        #{prid,jdbcType=INTEGER},
+      </if>
+      <if test="orderNo != null">
+        #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="aname != null">
+        #{aname,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="typeOther != null">
+        #{typeOther,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="processStatus != null">
+        #{processStatus,jdbcType=INTEGER},
+      </if>
+      <if test="totalAmount != null">
+        #{totalAmount,jdbcType=DECIMAL},
+      </if>
+      <if test="attachmentUrl != null">
+        #{attachmentUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="applyDep != null">
+        #{applyDep,jdbcType=VARCHAR},
+      </if>
+      <if test="payDep != null">
+        #{payDep,jdbcType=VARCHAR},
+      </if>
+      <if test="eaaid != null">
+        #{eaaid,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
+    update expense_account
+    <set>
+      <if test="prid != null">
+        prid = #{prid,jdbcType=INTEGER},
+      </if>
+      <if test="orderNo != null">
+        order_no = #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="aname != null">
+        aname = #{aname,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        `type` = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="typeOther != null">
+        type_other = #{typeOther,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="processStatus != null">
+        process_status = #{processStatus,jdbcType=INTEGER},
+      </if>
+      <if test="totalAmount != null">
+        total_amount = #{totalAmount,jdbcType=DECIMAL},
+      </if>
+      <if test="attachmentUrl != null">
+        attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="applyDep != null">
+        apply_dep = #{applyDep,jdbcType=VARCHAR},
+      </if>
+      <if test="payDep != null">
+        pay_dep = #{payDep,jdbcType=VARCHAR},
+      </if>
+      <if test="eaaid != null">
+        eaaid = #{eaaid,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ExpenseAccount">
+    update expense_account
+    set prid = #{prid,jdbcType=INTEGER},
+      order_no = #{orderNo,jdbcType=VARCHAR},
+      aid = #{aid,jdbcType=VARCHAR},
+      aname = #{aname,jdbcType=VARCHAR},
+      `type` = #{type,jdbcType=INTEGER},
+      type_other = #{typeOther,jdbcType=VARCHAR},
+      `status` = #{status,jdbcType=INTEGER},
+      process_status = #{processStatus,jdbcType=INTEGER},
+      total_amount = #{totalAmount,jdbcType=DECIMAL},
+      attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
+      apply_dep = #{applyDep,jdbcType=VARCHAR},
+      pay_dep = #{payDep,jdbcType=VARCHAR},
+      eaaid = #{eaaid,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 13 - 2
src/main/java/com/goafanti/common/mapper/ExpenseAccountPrivateMapper.xml

@@ -135,9 +135,13 @@
       and accounts =#{accounts}
     </if>
   </select>
-  <select id="selectExpenseAccountPrivateList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountPrivate">
-    select id ,aid,name ,bank ,accounts ,open_bank openBank ,status ,
+  <sql id="selectDetails">
+    id ,aid,name ,bank ,accounts ,open_bank openBank ,status ,
     date_format(create_time,'%Y-%m-%d %H:%i:%S') createTimeStr
+  </sql>
+  <select id="selectExpenseAccountPrivateList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountPrivate">
+    select
+    <include refid="selectDetails" />
     from expense_account_private
     where aid = #{aid}
     order by create_time desc
@@ -156,11 +160,18 @@
       from expense_account_private
       where accounts = #{accounts}
     </select>
+
     <update id="updateStatusByAid">
     update expense_account_private
     set status=0
     where aid =#{aid}
   </update>
+  <select id="selectById" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountPrivate">
+    select
+    <include refid="selectDetails" />
+    from expense_account_private
+    where id= #{id}
+  </select>
 
 
 </mapper>

+ 205 - 0
src/main/java/com/goafanti/common/model/ExpenseAccount.java

@@ -0,0 +1,205 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * expense_account
+ * @author 
+ */
+public class ExpenseAccount implements Serializable {
+    private Integer id;
+
+    /**
+     * 公出编号
+     */
+    private Integer prid;
+
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+
+    /**
+     * 报销人
+     */
+    private String aid;
+
+    /**
+     * 审核人名称
+     */
+    private String aname;
+
+    /**
+     * 状态 0=其他,1=差旅费,2=第三方付款,3=餐费,4=申请借支
+     */
+    private Integer type;
+
+    /**
+     * 其他状态说明
+     */
+    private String typeOther;
+
+    /**
+     * 状态 0=草稿,1=审核中,2=完成,3=驳回
+     */
+    private Integer status;
+
+    /**
+     * 流程状态 0=巴员发起,1=巴主发起或审核,2=总经理审核,3=财务审核,4=董事长审核
+     */
+    private Integer processStatus;
+
+    /**
+     * 总金额
+     */
+    private BigDecimal totalAmount;
+
+    /**
+     * 合同图片
+     */
+    private String attachmentUrl;
+
+    /**
+     * 申请部门
+     */
+    private String applyDep;
+
+    /**
+     * 支付部门
+     */
+    private String payDep;
+
+    /**
+     * 报销帐号编号
+     */
+    private Integer eaaid;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getPrid() {
+        return prid;
+    }
+
+    public void setPrid(Integer prid) {
+        this.prid = prid;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
+    public String getAname() {
+        return aname;
+    }
+
+    public void setAname(String aname) {
+        this.aname = aname;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getTypeOther() {
+        return typeOther;
+    }
+
+    public void setTypeOther(String typeOther) {
+        this.typeOther = typeOther;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getProcessStatus() {
+        return processStatus;
+    }
+
+    public void setProcessStatus(Integer processStatus) {
+        this.processStatus = processStatus;
+    }
+
+    public BigDecimal getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(BigDecimal totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public String getAttachmentUrl() {
+        return attachmentUrl;
+    }
+
+    public void setAttachmentUrl(String attachmentUrl) {
+        this.attachmentUrl = attachmentUrl;
+    }
+
+    public String getApplyDep() {
+        return applyDep;
+    }
+
+    public void setApplyDep(String applyDep) {
+        this.applyDep = applyDep;
+    }
+
+    public String getPayDep() {
+        return payDep;
+    }
+
+    public void setPayDep(String payDep) {
+        this.payDep = payDep;
+    }
+
+    public Integer getEaaid() {
+        return eaaid;
+    }
+
+    public void setEaaid(Integer eaaid) {
+        this.eaaid = eaaid;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 6 - 0
src/main/java/com/goafanti/common/utils/Param.java

@@ -1,6 +1,10 @@
 package com.goafanti.common.utils;
 
+import com.goafanti.common.constant.ErrorConstants;
+import org.springframework.context.annotation.Import;
+
 import javax.validation.Payload;
+import javax.validation.constraints.NotNull;
 import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.RUNTIME)
@@ -9,5 +13,7 @@ public @interface Param {
 
     String name() default "";
 
+    String message() default ErrorConstants.PARAM_EMPTY_ERROR;
+
 
 }

+ 20 - 0
src/main/java/com/goafanti/common/utils/ParamUtils.java

@@ -1,6 +1,7 @@
 package com.goafanti.common.utils;
 
 import java.lang.reflect.Field;
+import java.text.MessageFormat;
 
 public class ParamUtils {
 
@@ -22,4 +23,23 @@ public class ParamUtils {
         }
         return "";
     }
+
+    /**
+     * 根据@Param的字段名称获取name的设置值
+     * @param t 输入参数类型
+     * @param param 字段名称
+     * @param <T>
+     * @return
+     */
+    public static  <T> String  getParamMsg(T t,String param){
+        Class clazz=t.getClass();
+        for (Field f : clazz.getDeclaredFields()) {
+            if (f.getName().equals(param)){
+                Param filedAnno = f.getAnnotation(Param.class);
+                return filedAnno.message();
+            }
+        }
+        return "";
+    }
+    
 }

+ 24 - 0
src/main/java/com/goafanti/expenseAccount/bo/InputExpenseAccount.java

@@ -0,0 +1,24 @@
+package com.goafanti.expenseAccount.bo;
+
+import com.goafanti.common.model.ExpenseAccount;
+import com.goafanti.common.utils.Param;
+
+import javax.validation.constraints.NotNull;
+
+
+public class InputExpenseAccount extends ExpenseAccount {
+
+    @NotNull
+    @Param(name = "类型")
+    private Integer type;
+
+    @Override
+    public Integer getType() {
+        return type;
+    }
+
+    @Override
+    public void setType(Integer type) {
+        this.type = type;
+    }
+}

+ 9 - 54
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountController.java

@@ -6,8 +6,10 @@ import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.model.ExpenseAccountPrivate;
 import com.goafanti.common.utils.ParamUtils;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.expenseAccount.bo.InputExpenseAccount;
 import com.goafanti.expenseAccount.bo.InputExpenseAccountPrivate;
 import com.goafanti.expenseAccount.service.ExpenseAccountPrivateService;
+import com.goafanti.expenseAccount.service.ExpenseAccountService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
@@ -20,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
 public class ExpenseAccountController extends CertifyApiController {
 
     @Autowired
-    private ExpenseAccountPrivateService expenseAccountPrivateService;
+    private ExpenseAccountService expenseAccountService;
 
     /**
      * 新增私有报销帐号
@@ -28,67 +30,20 @@ public class ExpenseAccountController extends CertifyApiController {
      * @return
      */
     @RequestMapping(value = "/add",method = RequestMethod.POST)
-    public Result add(@Validated InputExpenseAccountPrivate in , BindingResult bindingResult){
+    public Result add(@Validated InputExpenseAccount in , BindingResult bindingResult){
         Result res =new Result();
         if (bindingResult.hasErrors()) {
-            res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
-                    ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
+            String param=bindingResult.getFieldError().getField();
+            res.getError().add(buildError(ParamUtils.getParamMsg(in,param),ParamUtils.getParamName(in,param)));
             return res;
         }
         in.setAid(TokenManager.getAdminId());
-        if (expenseAccountPrivateService.addCheckAccounts(in)){
-            res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_BEING_ERROR,"帐号"));
-            return res;
-        }
-        res.setData(expenseAccountPrivateService.add(in));
-        return res;
-    }
 
-    /**
-     * 新增私有报销帐号
-     * @param in
-     * @return
-     */
-    @RequestMapping(value = "/update",method = RequestMethod.POST)
-    public Result update(@Validated InputExpenseAccountPrivate in , BindingResult bindingResult){
-        Result res =new Result();
-        if (in.getId()==null){
-            res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"我的报销帐号编号"));
-            return res;
-        }
-        if (bindingResult.hasErrors()) {
-            res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
-                    ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
-            return res;
-        }
-        in.setAid(TokenManager.getAdminId());
-        if (expenseAccountPrivateService.updateCheckAccounts(in)){
-            res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_BEING_ERROR,"帐号"));
-            return res;
-        }
-        res.setData(expenseAccountPrivateService.update(in));
-        return res;
-    }
-    /**
-     * 私有报销帐号列表
-     * @return
-     */
-    @RequestMapping(value = "/updateStatus",method = RequestMethod.POST)
-    public Result updateStatus(ExpenseAccountPrivate in){
-        Result res =new Result();
-        res.setData(expenseAccountPrivateService.updateStatus(in));
-        return res;
-    }
-    /**
-     * 私有报销帐号列表
-     * @return
-     */
-    @RequestMapping(value = "/selectList",method = RequestMethod.GET)
-    public Result selectList(Integer pageSize,Integer pageNo){
-        Result res =new Result();
-        res.setData(expenseAccountPrivateService.selectList(pageSize,pageNo));
+        res.setData(expenseAccountService.add(in));
         return res;
     }
 
 
+
+
 }

+ 104 - 0
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountPrivateController.java

@@ -0,0 +1,104 @@
+package com.goafanti.expenseAccount.controller;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.model.ExpenseAccountPrivate;
+import com.goafanti.common.utils.ParamUtils;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.expenseAccount.bo.InputExpenseAccountPrivate;
+import com.goafanti.expenseAccount.service.ExpenseAccountPrivateService;
+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("/api/admin/expenseAccountPrivate")
+public class ExpenseAccountPrivateController extends CertifyApiController {
+
+    @Autowired
+    private ExpenseAccountPrivateService expenseAccountPrivateService;
+
+    /**
+     * 新增私有报销帐号
+     * @param in
+     * @return
+     */
+    @RequestMapping(value = "/add",method = RequestMethod.POST)
+    public Result add(@Validated InputExpenseAccountPrivate 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;
+        }
+        in.setAid(TokenManager.getAdminId());
+        if (expenseAccountPrivateService.addCheckAccounts(in)){
+            res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_BEING_ERROR,"帐号"));
+            return res;
+        }
+        res.setData(expenseAccountPrivateService.add(in));
+        return res;
+    }
+
+    /**
+     * 新增私有报销帐号
+     * @param in
+     * @return
+     */
+    @RequestMapping(value = "/update",method = RequestMethod.POST)
+    public Result update(@Validated InputExpenseAccountPrivate in , BindingResult bindingResult){
+        Result res =new Result();
+        if (in.getId()==null){
+            res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"我的报销帐号编号"));
+            return res;
+        }
+        if (bindingResult.hasErrors()) {
+            res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+                    ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
+            return res;
+        }
+        in.setAid(TokenManager.getAdminId());
+        if (expenseAccountPrivateService.updateCheckAccounts(in)){
+            res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_BEING_ERROR,"帐号"));
+            return res;
+        }
+        res.setData(expenseAccountPrivateService.update(in));
+        return res;
+    }
+    /**
+     * 私有报销帐号列表
+     * @return
+     */
+    @RequestMapping(value = "/updateStatus",method = RequestMethod.POST)
+    public Result updateStatus(ExpenseAccountPrivate in){
+        Result res =new Result();
+        res.setData(expenseAccountPrivateService.updateStatus(in));
+        return res;
+    }
+    /**
+     * 私有报销帐号列表
+     * @return
+     */
+    @RequestMapping(value = "/selectList",method = RequestMethod.GET)
+    public Result selectList(Integer pageSize,Integer pageNo){
+        Result res =new Result();
+        res.setData(expenseAccountPrivateService.selectList(pageSize,pageNo));
+        return res;
+    }
+
+
+    @RequestMapping(value = "/details",method = RequestMethod.GET)
+    public Result details(Integer id){
+        Result res =new Result();
+        res.setData(expenseAccountPrivateService.details(id));
+        return res;
+    }
+
+
+
+
+}

+ 3 - 0
src/main/java/com/goafanti/expenseAccount/service/ExpenseAccountPrivateService.java

@@ -2,6 +2,7 @@ package com.goafanti.expenseAccount.service;
 
 import com.goafanti.common.model.ExpenseAccountPrivate;
 import com.goafanti.expenseAccount.bo.InputExpenseAccountPrivate;
+import com.goafanti.expenseAccount.bo.OutExpenseAccountPrivate;
 
 public interface ExpenseAccountPrivateService {
     int add(InputExpenseAccountPrivate in);
@@ -16,4 +17,6 @@ public interface ExpenseAccountPrivateService {
     boolean addCheckAccounts(InputExpenseAccountPrivate in);
 
     int updateStatus(ExpenseAccountPrivate in);
+
+    OutExpenseAccountPrivate details(Integer id);
 }

+ 7 - 0
src/main/java/com/goafanti/expenseAccount/service/ExpenseAccountService.java

@@ -0,0 +1,7 @@
+package com.goafanti.expenseAccount.service;
+
+import com.goafanti.expenseAccount.bo.InputExpenseAccount;
+
+public interface ExpenseAccountService {
+    int add(InputExpenseAccount in);
+}

+ 8 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountPrivateServiceImpl.java

@@ -6,6 +6,7 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.expenseAccount.bo.InputExpenseAccountPrivate;
+import com.goafanti.expenseAccount.bo.OutExpenseAccountPrivate;
 import com.goafanti.expenseAccount.service.ExpenseAccountPrivateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -77,6 +78,8 @@ public class ExpenseAccountPrivateServiceImpl extends BaseMybatisDao<ExpenseAcco
         return expenseAccountPrivateMapper.updateByPrimaryKeySelective(update);
     }
 
+
+
     private Integer checkCount(InputExpenseAccountPrivate in) {
         InputExpenseAccountPrivate check=new InputExpenseAccountPrivate();
         check.setAid(in.getAid());
@@ -100,4 +103,9 @@ public class ExpenseAccountPrivateServiceImpl extends BaseMybatisDao<ExpenseAcco
         }
 
     }
+
+    @Override
+    public OutExpenseAccountPrivate details(Integer id) {
+        return expenseAccountPrivateMapper.selectById(id);
+    }
 }

+ 13 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -0,0 +1,13 @@
+package com.goafanti.expenseAccount.service.impl;
+
+import com.goafanti.expenseAccount.bo.InputExpenseAccount;
+import com.goafanti.expenseAccount.service.ExpenseAccountService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ExpenseAccountServiceImpl implements ExpenseAccountService {
+    @Override
+    public int add(InputExpenseAccount in) {
+        return 0;
+    }
+}

+ 5 - 5
src/main/resources/props/config_local.properties

@@ -1,12 +1,12 @@
 dev.name=local
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #jdbc.url=jdbc\:mysql://localhost:3306/aft20221026?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.username=root
-#jdbc.password=123456
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
-jdbc.password=aftdev
+jdbc.password=123456
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20