Browse Source

报销小程序发起、审核、修改站内+微信订阅消息+邮件+日志开发

anderx 2 years ago
parent
commit
d0aeb74a9c

+ 9 - 4
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -3038,8 +3038,9 @@ public class AdminApiController extends CertifyApiController {
 	@RequestMapping(value ="/setOpenId" , method = RequestMethod.POST)
 	public Result setOpenId(String code,Integer type) {
 		Result res =new Result();
+		if(type==null)type=0;
 		String url = "https://api.weixin.qq.com/sns/jscode2session?";
-		if (type!=null&&type==1){
+		if (type==1){
 			url=url+"appid="+expenseAppId+"&secret="+expenseAppSecret+"&js_code="+code+"&grant_type=authorization_code";
 		}else{
 			url=url+"appid="+appId+"&secret="+appSecret+"&js_code="+code+"&grant_type=authorization_code";
@@ -3048,11 +3049,15 @@ public class AdminApiController extends CertifyApiController {
 		System.out.println(json.toJSONString());
 		String openid=json.getString("openid");
 		if (StringUtils.isNotBlank(openid)) {
-			LoggerUtils.debug(getClass(), "获取openid"+openid);
+			LoggerUtils.debug(getClass(), "获取"+(type==1?"报销":"公出")+"openid"+openid);
 			Admin a=new Admin();
+			if (type!=null&&type==1){
+				a.setExpenseOpenId(openid);
+			}else {
+				a.setOpenId(openid);
+			}
 			a.setId(TokenManager.getAdminId());
-			a.setOpenId(openid);
-//			adminService.updateByPrimaryKey(a);
+			adminService.updateByPrimaryKey(a);
 			res.data(1);
 		}else {
 			res.getError().add(buildError("openid绑定失败"));

+ 2 - 0
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -161,6 +161,8 @@ public class AdminSuperviserApiController extends CertifyApiController {
 			ad.setPassword(useAdmin.getPassword());
 			ad.setCreateTime(useAdmin.getCreateTime());
 			ad.setLastLoginTime(useAdmin.getLastLoginTime());
+			ad.setExpenseOpenId(useAdmin.getExpenseOpenId());
+			ad.setOpenId(useAdmin.getOpenId());
 			res = disposeAdminLocationList(res, jo, ad);
 			if (!res.getError().isEmpty()) {
 				return res;

+ 37 - 31
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -30,12 +30,13 @@
     <result column="manager_id" jdbcType="VARCHAR" property="managerId" />
     <result column="senior_staff" jdbcType="INTEGER" property="seniorStaff" />
     <result column="public_purview" jdbcType="INTEGER" property="publicPurview" />
+    <result column="expense_open_id" jdbcType="VARCHAR" property="expenseOpenId" />
   </resultMap>
   <sql id="Base_Column_List">
     id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
     superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
     contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role, amb_manage,
-    manager_id, senior_staff, public_purview
+    manager_id, senior_staff, public_purview, expense_open_id
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -47,34 +48,31 @@
     delete from admin
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.Admin">
-    insert into admin (id, mobile, `name`,
-      `password`, email, create_time,
-      `number`, province, `position`,
-      superior_id, city, department_id,
-      `status`, user_no, duty,
-      district, head_portrait_url, contact_mobile,
-      last_login_time, open_id, `type`,
-      reviewer, amb_id, amb_role,
-      amb_manage, manager_id, senior_staff,
-      public_purview)
-    values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
-      #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
-      #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
-      #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
-      #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
-      #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
-      #{lastLoginTime,jdbcType=TIMESTAMP}, #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
-      #{reviewer,jdbcType=VARCHAR}, #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR},
-      #{ambManage,jdbcType=INTEGER}, #{managerId,jdbcType=VARCHAR}, #{seniorStaff,jdbcType=INTEGER},
-      #{publicPurview,jdbcType=INTEGER})
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
+    insert into admin (mobile, `name`, `password`,
+      email, create_time, `number`,
+      province, `position`, superior_id,
+      city, department_id, `status`,
+      user_no, duty, district,
+      head_portrait_url, contact_mobile, last_login_time,
+      open_id, `type`, reviewer,
+      amb_id, amb_role, amb_manage,
+      manager_id, senior_staff, public_purview,
+      expense_open_id)
+    values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
+      #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
+      #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
+      #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
+      #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
+      #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
+      #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
+      #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}, #{ambManage,jdbcType=INTEGER},
+      #{managerId,jdbcType=VARCHAR}, #{seniorStaff,jdbcType=INTEGER}, #{publicPurview,jdbcType=INTEGER},
+      #{expenseOpenId,jdbcType=VARCHAR})
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
     insert into admin
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="mobile != null">
         mobile,
       </if>
@@ -156,11 +154,11 @@
       <if test="publicPurview != null">
         public_purview,
       </if>
+      <if test="expenseOpenId != null">
+        expense_open_id,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
       <if test="mobile != null">
         #{mobile,jdbcType=VARCHAR},
       </if>
@@ -242,6 +240,9 @@
       <if test="publicPurview != null">
         #{publicPurview,jdbcType=INTEGER},
       </if>
+      <if test="expenseOpenId != null">
+        #{expenseOpenId,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -328,6 +329,9 @@
       <if test="publicPurview != null">
         public_purview = #{publicPurview,jdbcType=INTEGER},
       </if>
+      <if test="expenseOpenId != null">
+        expense_open_id = #{expenseOpenId,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -359,13 +363,15 @@
       amb_manage = #{ambManage,jdbcType=INTEGER},
       manager_id = #{managerId,jdbcType=VARCHAR},
       senior_staff = #{seniorStaff,jdbcType=INTEGER},
-      public_purview = #{publicPurview,jdbcType=INTEGER}
+      public_purview = #{publicPurview,jdbcType=INTEGER},
+      expense_open_id = #{expenseOpenId,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
 
 
 
 
+
   <select id="selectAllAdmin" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
@@ -641,7 +647,7 @@
     <if test="seniorStaff != null">
       and a.senior_staff = #{seniorStaff}
     </if>
-      <if test="publicPurview != null">
+    <if test="publicPurview != null">
       and a.public_purview = #{publicPurview}
     </if>
 

+ 16 - 3
src/main/java/com/goafanti/common/model/Admin.java

@@ -101,7 +101,7 @@ public class Admin extends BaseModel implements AftUser {
     private Date lastLoginTime;
 
     /**
-     * 微信公共编号
+     * 打卡小程序微信公共编号
      */
     private String openId;
 
@@ -136,15 +136,20 @@ public class Admin extends BaseModel implements AftUser {
     private String managerId;
 
     /**
-     * 0新员工 1老员工
+     * 员工分类 0新员工 1老员工
      */
     private Integer seniorStaff;
 
     /**
-     * 0正常 1全部
+     * 公出权限 0正常 1全部
      */
     private Integer publicPurview;
 
+    /**
+     * 报销小程序微信公共编号
+     */
+    private String expenseOpenId;
+
     private static final long serialVersionUID = 1L;
 
 
@@ -417,4 +422,12 @@ public class Admin extends BaseModel implements AftUser {
     public void setPublicPurview(Integer publicPurview) {
         this.publicPurview = publicPurview;
     }
+
+    public String getExpenseOpenId() {
+        return expenseOpenId;
+    }
+
+    public void setExpenseOpenId(String expenseOpenId) {
+        this.expenseOpenId = expenseOpenId;
+    }
 }