Commit 8c41a1c3 by qwmqiuwenmin

fix

parent aadae5b5
...@@ -7,6 +7,8 @@ public class StaffDTO implements Serializable{ ...@@ -7,6 +7,8 @@ public class StaffDTO implements Serializable{
private String staffId; private String staffId;
private String wxEnterpriseId;
private String wxUserId; private String wxUserId;
private String phoneNumber; private String phoneNumber;
...@@ -41,6 +43,48 @@ public class StaffDTO implements Serializable{ ...@@ -41,6 +43,48 @@ public class StaffDTO implements Serializable{
this.staffId = staffId == null ? null : staffId.trim(); this.staffId = staffId == null ? null : staffId.trim();
} }
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getExtendPostion() {
return extendPostion;
}
public void setExtendPostion(String extendPostion) {
this.extendPostion = extendPostion;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getWxUserId() { public String getWxUserId() {
return wxUserId; return wxUserId;
} }
......
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
public interface StaffApiService { public interface StaffApiService {
public StaffDTO selectById(String staffId); public StaffDTO selectById(String staffId);
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
public HaobanResponse add(StaffDTO staff, String departmentIds);
} }
...@@ -14,4 +14,6 @@ public interface StaffMapper { ...@@ -14,4 +14,6 @@ public interface StaffMapper {
int updateByPrimaryKeySelective(TabHaobanStaff record); int updateByPrimaryKeySelective(TabHaobanStaff record);
int updateByPrimaryKey(TabHaobanStaff record); int updateByPrimaryKey(TabHaobanStaff record);
TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
} }
\ No newline at end of file
...@@ -18,6 +18,8 @@ public class TabHaobanStaff implements Serializable { ...@@ -18,6 +18,8 @@ public class TabHaobanStaff implements Serializable {
private Integer sex; private Integer sex;
private String wxEnterpriseId;
private String postion; private String postion;
private Integer activeFlag; private Integer activeFlag;
...@@ -135,4 +137,14 @@ public class TabHaobanStaff implements Serializable { ...@@ -135,4 +137,14 @@ public class TabHaobanStaff implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
} }
\ No newline at end of file
...@@ -6,4 +6,8 @@ public interface StaffService { ...@@ -6,4 +6,8 @@ public interface StaffService {
TabHaobanStaff selectById(String staffId); TabHaobanStaff selectById(String staffId);
TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
String add(TabHaobanStaff tab);
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
...@@ -19,4 +22,19 @@ public class StaffServiceImpl implements StaffService { ...@@ -19,4 +22,19 @@ public class StaffServiceImpl implements StaffService {
return mapper.selectByPrimaryKey(id); return mapper.selectByPrimaryKey(id);
} }
@Override
public TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber) {
return mapper.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
}
@Override
public String add(TabHaobanStaff tab) {
Date now = new Date();
tab.setCreateTime(now);
tab.setUpdateTime(now);
tab.setStaffId(StringUtil.randomUUID());
tab.setStatusFlag(1);
return tab.getStaffId();
}
} }
...@@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
...@@ -21,4 +22,20 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -21,4 +22,20 @@ public class StaffApiServiceImpl implements StaffApiService {
return EntityUtil.changeEntityByJSON(StaffDTO.class, staff); return EntityUtil.changeEntityByJSON(StaffDTO.class, staff);
} }
@Override
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber) {
TabHaobanStaff staff = staffService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
return EntityUtil.changeEntityByJSON(StaffDTO.class, staff);
}
@Override
public HaobanResponse add(StaffDTO staff, String departmentIds) {
Integer activeFlag = staff.getActiveFlag();
TabHaobanStaff tab = EntityUtil.changeEntityByJSON(TabHaobanStaff.class, staff);
String staffId = staffService.add(tab);
return null;
}
} }
...@@ -213,4 +213,24 @@ ...@@ -213,4 +213,24 @@
where related_id = #{relatedId,jdbcType=VARCHAR} where related_id = #{relatedId,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1
</select> </select>
<select id="pageDepartmentByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="keyword != null and keyword != ''">
and department_name like CONCAT('%',#{keyWord},'%')
</if>
<if test="recycleFlag != null">
and recycle_flag = #{recycleFlag}
</if>
<if test="storeFlag != null">
and is_store = #{storeFlag}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanStaff" > <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
<id column="staff_id" property="staffId" jdbcType="VARCHAR" /> <id column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" /> <result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="phone_number" property="phoneNumber" jdbcType="VARCHAR" /> <result column="phone_number" property="phoneNumber" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" /> <result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="nation_code" property="nationCode" jdbcType="VARCHAR" /> <result column="nation_code" property="nationCode" jdbcType="VARCHAR" />
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
staff_id, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion, staff_id, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion,
active_flag, extend_postion, status_flag, create_time, update_time active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -35,12 +36,12 @@ ...@@ -35,12 +36,12 @@
staff_name, nation_code, nick_name, staff_name, nation_code, nick_name,
sex, postion, active_flag, sex, postion, active_flag,
extend_postion, status_flag, create_time, extend_postion, status_flag, create_time,
update_time) update_time,wx_enterprise_id)
values (#{staffId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR}, values (#{staffId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
#{staffName,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{staffName,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR},
#{sex,jdbcType=INTEGER}, #{postion,jdbcType=VARCHAR}, #{activeFlag,jdbcType=INTEGER}, #{sex,jdbcType=INTEGER}, #{postion,jdbcType=VARCHAR}, #{activeFlag,jdbcType=INTEGER},
#{extendPostion,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{extendPostion,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}) #{updateTime,jdbcType=TIMESTAMP},#{wxEnterpriseId})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
insert into tab_haoban_staff insert into tab_haoban_staff
...@@ -51,6 +52,9 @@ ...@@ -51,6 +52,9 @@
<if test="wxUserId != null" > <if test="wxUserId != null" >
wx_user_id, wx_user_id,
</if> </if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id,
</if>
<if test="phoneNumber != null" > <if test="phoneNumber != null" >
phone_number, phone_number,
</if> </if>
...@@ -92,6 +96,9 @@ ...@@ -92,6 +96,9 @@
<if test="wxUserId != null" > <if test="wxUserId != null" >
#{wxUserId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="phoneNumber != null" > <if test="phoneNumber != null" >
#{phoneNumber,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
</if> </if>
...@@ -133,6 +140,9 @@ ...@@ -133,6 +140,9 @@
<if test="wxUserId != null" > <if test="wxUserId != null" >
wx_user_id = #{wxUserId,jdbcType=VARCHAR}, wx_user_id = #{wxUserId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="phoneNumber != null" > <if test="phoneNumber != null" >
phone_number = #{phoneNumber,jdbcType=VARCHAR}, phone_number = #{phoneNumber,jdbcType=VARCHAR},
</if> </if>
...@@ -172,6 +182,7 @@ ...@@ -172,6 +182,7 @@
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" > <update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
update tab_haoban_staff update tab_haoban_staff
set wx_user_id = #{wxUserId,jdbcType=VARCHAR}, set wx_user_id = #{wxUserId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
phone_number = #{phoneNumber,jdbcType=VARCHAR}, phone_number = #{phoneNumber,jdbcType=VARCHAR},
staff_name = #{staffName,jdbcType=VARCHAR}, staff_name = #{staffName,jdbcType=VARCHAR},
nation_code = #{nationCode,jdbcType=VARCHAR}, nation_code = #{nationCode,jdbcType=VARCHAR},
...@@ -185,4 +196,14 @@ ...@@ -185,4 +196,14 @@
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_id = #{staffId,jdbcType=VARCHAR} where staff_id = #{staffId,jdbcType=VARCHAR}
</update> </update>
<select id="selectByNationcodeAndPhoneNumber" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where nation_code = #{nationCode}
and phone_number = #{phoneNumber}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO;
@RestController
public class StaffController extends WebBaseController{
@Autowired
private StaffApiService staffApiService;
@RequestMapping("staff-add")
public HaobanResponse staffAdd(StaffDTO staffDTO,String departmentIds){
LoginVO login = (LoginVO) AuthRequestUtil.getAppLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
String staffName = staffDTO.getStaffName();
String phoneNumber = staffDTO.getPhoneNumber();
String nationcode = staffDTO.getNationCode();
if(StringUtils.isBlank(staffName)) {
return resultResponse(HaoBanErrCode.ERR_10004);
}
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
if(staff != null) {
return resultResponse(HaoBanErrCode.ERR_10005);
}
HaobanResponse hr = staffApiService.add(staff,departmentIds);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
...@@ -65,6 +65,10 @@ public enum HaoBanErrCode { ...@@ -65,6 +65,10 @@ public enum HaoBanErrCode {
ERR_10002(10002,"门店类型部门不能新增子节点"), ERR_10002(10002,"门店类型部门不能新增子节点"),
ERR_10003(10003,"部门不存在"), ERR_10003(10003,"部门不存在"),
ERR_10004(10004,"成员名称不能为空"),
ERR_10005(10005,"成员已存在"),
ERR_DEFINE(-888, "自定义错误"), ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code"); ERR_OTHER(-999, "未知错误code");
private int code; private int code;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment