anderx лет назад: 2
Родитель
Сommit
52a0f18527

+ 21 - 0
src/main/java/com/goafanti/common/dao/ExpenseConfigDetailsMapper.java

@@ -0,0 +1,21 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.ExpenseConfigDetails;
+
+import java.util.List;
+
+public interface ExpenseConfigDetailsMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(ExpenseConfigDetails record);
+
+    int insertSelective(ExpenseConfigDetails record);
+
+    ExpenseConfigDetails selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(ExpenseConfigDetails record);
+
+    int updateByPrimaryKey(ExpenseConfigDetails record);
+
+    List<ExpenseConfigDetails> selectAll();
+}

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

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

+ 93 - 0
src/main/java/com/goafanti/common/mapper/ExpenseConfigDetailsMapper.xml

@@ -0,0 +1,93 @@
+<?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.ExpenseConfigDetailsMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.ExpenseConfigDetails">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="admin_name" jdbcType="VARCHAR" property="adminName" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, `type`, aid, admin_name, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from expense_config_details
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from expense_config_details
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseConfigDetails" useGeneratedKeys="true">
+    insert into expense_config_details (`type`, aid, admin_name,
+      create_time)
+    values (#{type,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR}, #{adminName,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseConfigDetails" useGeneratedKeys="true">
+    insert into expense_config_details
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="type != null">
+        `type`,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="adminName != null">
+        admin_name,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="adminName != null">
+        #{adminName,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseConfigDetails">
+    update expense_config_details
+    <set>
+      <if test="type != null">
+        `type` = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="adminName != null">
+        admin_name = #{adminName,jdbcType=VARCHAR},
+      </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.ExpenseConfigDetails">
+    update expense_config_details
+    set `type` = #{type,jdbcType=INTEGER},
+      aid = #{aid,jdbcType=VARCHAR},
+      admin_name = #{adminName,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <select id="selectAll"  resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from expense_config_details
+  </select>
+</mapper>

+ 76 - 0
src/main/java/com/goafanti/common/mapper/ExpenseConfigMapper.xml

@@ -0,0 +1,76 @@
+<?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.ExpenseConfigMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.ExpenseConfig">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="ceo_examine" jdbcType="INTEGER" property="ceoExamine" />
+    <result column="cfo_examine" jdbcType="INTEGER" property="cfoExamine" />
+    <result column="vice_ceo_examine" jdbcType="INTEGER" property="viceCeoExamine" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, ceo_examine, cfo_examine, vice_ceo_examine
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from expense_config
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from expense_config
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseConfig" useGeneratedKeys="true">
+    insert into expense_config (ceo_examine, cfo_examine, vice_ceo_examine
+      )
+    values (#{ceoExamine,jdbcType=INTEGER}, #{cfoExamine,jdbcType=INTEGER}, #{viceCeoExamine,jdbcType=INTEGER}
+      )
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseConfig" useGeneratedKeys="true">
+    insert into expense_config
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="ceoExamine != null">
+        ceo_examine,
+      </if>
+      <if test="cfoExamine != null">
+        cfo_examine,
+      </if>
+      <if test="viceCeoExamine != null">
+        vice_ceo_examine,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="ceoExamine != null">
+        #{ceoExamine,jdbcType=INTEGER},
+      </if>
+      <if test="cfoExamine != null">
+        #{cfoExamine,jdbcType=INTEGER},
+      </if>
+      <if test="viceCeoExamine != null">
+        #{viceCeoExamine,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseConfig">
+    update expense_config
+    <set>
+      <if test="ceoExamine != null">
+        ceo_examine = #{ceoExamine,jdbcType=INTEGER},
+      </if>
+      <if test="cfoExamine != null">
+        cfo_examine = #{cfoExamine,jdbcType=INTEGER},
+      </if>
+      <if test="viceCeoExamine != null">
+        vice_ceo_examine = #{viceCeoExamine,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ExpenseConfig">
+    update expense_config
+    set ceo_examine = #{ceoExamine,jdbcType=INTEGER},
+      cfo_examine = #{cfoExamine,jdbcType=INTEGER},
+      vice_ceo_examine = #{viceCeoExamine,jdbcType=INTEGER}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 60 - 0
src/main/java/com/goafanti/common/model/ExpenseConfig.java

@@ -0,0 +1,60 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+
+/**
+ * expense_config
+ * @author 
+ */
+public class ExpenseConfig implements Serializable {
+    private Integer id;
+
+    /**
+     * 董事长审核
+     */
+    private Integer ceoExamine;
+
+    /**
+     * 财务总监审核
+     */
+    private Integer cfoExamine;
+
+    /**
+     * 集团副总审核
+     */
+    private Integer viceCeoExamine;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getCeoExamine() {
+        return ceoExamine;
+    }
+
+    public void setCeoExamine(Integer ceoExamine) {
+        this.ceoExamine = ceoExamine;
+    }
+
+    public Integer getCfoExamine() {
+        return cfoExamine;
+    }
+
+    public void setCfoExamine(Integer cfoExamine) {
+        this.cfoExamine = cfoExamine;
+    }
+
+    public Integer getViceCeoExamine() {
+        return viceCeoExamine;
+    }
+
+    public void setViceCeoExamine(Integer viceCeoExamine) {
+        this.viceCeoExamine = viceCeoExamine;
+    }
+}

+ 74 - 0
src/main/java/com/goafanti/common/model/ExpenseConfigDetails.java

@@ -0,0 +1,74 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * expense_config_details
+ * @author 
+ */
+public class ExpenseConfigDetails implements Serializable {
+    private Integer id;
+
+    /**
+     * 1=董事长,2=财务总监,3=集团副总
+     */
+    private Integer type;
+
+    /**
+     * 管理员编号
+     */
+    private String aid;
+
+    /**
+     * 管理员名称编号牌
+     */
+    private String adminName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
+    public String getAdminName() {
+        return adminName;
+    }
+
+    public void setAdminName(String adminName) {
+        this.adminName = adminName;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 47 - 0
src/main/java/com/goafanti/expenseAccount/controller/ExpenseConfigController.java

@@ -0,0 +1,47 @@
+package com.goafanti.expenseAccount.controller;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.model.ExpenseConfig;
+import com.goafanti.common.model.ExpenseConfigDetails;
+import com.goafanti.expenseAccount.service.ExpenseConfigService;
+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.RestController;
+
+@RestController
+@RequestMapping("/api/admin/expenseConfig")
+public class ExpenseConfigController extends CertifyApiController {
+
+    @Autowired
+    private ExpenseConfigService expenseConfigService;
+
+
+    @RequestMapping(value = "/update",method= RequestMethod.POST)
+    public Result update(ExpenseConfig config){
+        Result res =new Result();
+        return res.data(expenseConfigService.update(config));
+    }
+
+    @RequestMapping(value = "/addDeTails",method= RequestMethod.POST)
+    public Result add(ExpenseConfigDetails details){
+        Result res =new Result();
+        return res.data(expenseConfigService.addDeTails(details));
+    }
+
+    @RequestMapping(value = "/configDetails",method= RequestMethod.GET)
+    public Result configDetails(){
+        Result res =new Result();
+        return res.data(expenseConfigService.configDetails());
+    }
+
+
+    @RequestMapping(value = "/configDetailsEvict",method= RequestMethod.POST)
+    public Result configDetailsEvict(){
+        Result res =new Result();
+        return res.data(expenseConfigService.configDetailsEvict());
+    }
+
+
+}

+ 14 - 0
src/main/java/com/goafanti/expenseAccount/service/ExpenseConfigService.java

@@ -0,0 +1,14 @@
+package com.goafanti.expenseAccount.service;
+
+import com.goafanti.common.model.ExpenseConfig;
+import com.goafanti.common.model.ExpenseConfigDetails;
+
+public interface ExpenseConfigService {
+    Integer update(ExpenseConfig config);
+
+    Object addDeTails(ExpenseConfigDetails details);
+
+    Object configDetails();
+
+    Object configDetailsEvict();
+}

+ 58 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseConfigServiceImpl.java

@@ -0,0 +1,58 @@
+package com.goafanti.expenseAccount.service.impl;
+
+import com.goafanti.common.dao.ExpenseConfigDetailsMapper;
+import com.goafanti.common.dao.ExpenseConfigMapper;
+import com.goafanti.common.model.ExpenseConfig;
+import com.goafanti.common.model.ExpenseConfigDetails;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.expenseAccount.service.ExpenseConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ExpenseConfigServiceImpl implements ExpenseConfigService {
+
+    @Autowired
+    private ExpenseConfigMapper expenseConfigMapper;
+    @Autowired
+    private ExpenseConfigDetailsMapper expenseConfigDetailsMapper;
+
+
+    @Override
+    public Integer update(ExpenseConfig config) {
+        config.setId(1);
+        return expenseConfigMapper.updateByPrimaryKeySelective(config);
+    }
+
+    @Override
+    public Object addDeTails(ExpenseConfigDetails details) {
+        return expenseConfigDetailsMapper.insertSelective(details);
+    }
+
+    @Override
+    @Cacheable(value = "configDetails")
+    public Object configDetails() {
+        Map<String ,Object> map =new HashMap<>();
+        ExpenseConfig expenseConfig = expenseConfigMapper.selectByPrimaryKey(1);
+        List<ExpenseConfigDetails> expenseConfigDetails = expenseConfigDetailsMapper.selectAll();
+
+        map.put("config",expenseConfig);
+        map.put("ceo",expenseConfigDetails.stream().filter(e -> e.getType() == 1).collect(Collectors.toList()));
+        map.put("cfo",expenseConfigDetails.stream().filter(e -> e.getType() == 2).collect(Collectors.toList()));
+        map.put("vice_ceo",expenseConfigDetails.stream().filter(e -> e.getType() == 3).collect(Collectors.toList()));
+        return map;
+    }
+
+    @Override
+    @CacheEvict
+    public Object configDetailsEvict() {
+        LoggerUtils.debug(getClass(),"清除缓存数据");
+        return 1;
+    }
+
+}

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

@@ -52,7 +52,7 @@ yxjl_max=100
 amb.maxLvl=6
 
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.3.01
+static.host=//static.jishutao.com/1.3.02
 rd.static.host=//static.jishutao.com/RD/1.0.03
 #avatar.host=//172.16.0.255:3000
 #static.host=//172.16.0.255:3000/1.2.62