Commit 6d5c9477 by qwmqiuwenmin

fix

parent 8c41a1c3
...@@ -33,6 +33,10 @@ public class StaffDTO implements Serializable{ ...@@ -33,6 +33,10 @@ public class StaffDTO implements Serializable{
private Date updateTime; private Date updateTime;
private String departmentIds;
private String headImg;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getStaffId() { public String getStaffId() {
...@@ -149,5 +153,21 @@ public class StaffDTO implements Serializable{ ...@@ -149,5 +153,21 @@ public class StaffDTO implements Serializable{
this.activeFlag = activeFlag; this.activeFlag = activeFlag;
} }
public String getDepartmentIds() {
return departmentIds;
}
public void setDepartmentIds(String departmentIds) {
this.departmentIds = departmentIds;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
} }
...@@ -24,6 +24,8 @@ public class TabHaobanStaffDepartmentRelated implements Serializable { ...@@ -24,6 +24,8 @@ public class TabHaobanStaffDepartmentRelated implements Serializable {
private Date updateTime; private Date updateTime;
private String headImg;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getStaffDepartmentRelatedId() { public String getStaffDepartmentRelatedId() {
...@@ -105,4 +107,14 @@ public class TabHaobanStaffDepartmentRelated implements Serializable { ...@@ -105,4 +107,14 @@ public class TabHaobanStaffDepartmentRelated implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
} }
\ No newline at end of file
...@@ -2,10 +2,13 @@ package com.gic.haoban.manage.service.service; ...@@ -2,10 +2,13 @@ package com.gic.haoban.manage.service.service;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
public interface StaffDepartmentRelatedService { public interface StaffDepartmentRelatedService {
List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId); List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId);
String add(StaffDepartmentRelatedDTO related);
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils;
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.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
...@@ -22,4 +26,17 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -22,4 +26,17 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
return mapper.listByDepartmentId(departmentId); return mapper.listByDepartmentId(departmentId);
} }
@Override
public String add(StaffDepartmentRelatedDTO related) {
Date now = new Date();
related.setCreateTime(now);
related.setUpdateTime(now);
related.setStatusFlag(1);
related.setStaffDepartmentRelatedId(StringUtil.randomUUID());
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, related);
mapper.insert(tab);
return related.getStaffDepartmentRelatedId();
}
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import org.apache.commons.lang.StringUtils;
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.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; 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.dto.StaffDepartmentRelatedDTO;
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;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
@Service @Service
...@@ -16,6 +19,9 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -16,6 +19,9 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired @Autowired
StaffService staffService; StaffService staffService;
@Autowired
StaffDepartmentRelatedService staffDepartmentRelatedService;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
TabHaobanStaff staff = staffService.selectById(staffId); TabHaobanStaff staff = staffService.selectById(staffId);
...@@ -30,12 +36,32 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -30,12 +36,32 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public HaobanResponse add(StaffDTO staff, String departmentIds) { public HaobanResponse add(StaffDTO staff, String departmentIds) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
Integer activeFlag = staff.getActiveFlag(); Integer activeFlag = staff.getActiveFlag();
TabHaobanStaff tab = EntityUtil.changeEntityByJSON(TabHaobanStaff.class, staff); TabHaobanStaff tab = EntityUtil.changeEntityByJSON(TabHaobanStaff.class, staff);
String staffId = staffService.add(tab); String staffId = staffService.add(tab);
//调接口获取
String wxUserId = "";
if(StringUtils.isNotBlank(wxUserId)){
String[] departmentIdArr = departmentIds.split(",");
for (String string : departmentIdArr) {
StaffDepartmentRelatedDTO related = new StaffDepartmentRelatedDTO();
related.setDepartmentId(string);
related.setNationCode(staff.getNationCode());
related.setPhoneNumber(staff.getPhoneNumber());
related.setStaffId(staffId);
related.setWxUserId(wxUserId);
staffDepartmentRelatedService.add(related);
}
}else {
hr.setErrorCode(0);
hr.setMessage("微信端新增失败");
}
return null; return hr;
} }
} }
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
<result column="department_id" property="departmentId" jdbcType="VARCHAR" /> <result column="department_id" property="departmentId" jdbcType="VARCHAR" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="clerk_code" property="clerkCode" jdbcType="VARCHAR" /> <result column="clerk_code" property="clerkCode" jdbcType="VARCHAR" />
<result column="head_img" property="clerkCode" jdbcType="headImg" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
staff_department_related_id, staff_id, phone_number, nation_code, wx_user_id, department_id, staff_department_related_id, staff_id, phone_number, nation_code, wx_user_id, department_id,
status_flag, clerk_code, create_time, update_time status_flag, clerk_code, create_time, update_time,head_img
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -31,11 +32,11 @@ ...@@ -31,11 +32,11 @@
insert into tab_haoban_staff_department_related (staff_department_related_id, staff_id, insert into tab_haoban_staff_department_related (staff_department_related_id, staff_id,
phone_number, nation_code, wx_user_id, phone_number, nation_code, wx_user_id,
department_id, status_flag, clerk_code, department_id, status_flag, clerk_code,
create_time, update_time) create_time, update_time,head_img)
values (#{staffDepartmentRelatedId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR}, values (#{staffDepartmentRelatedId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{phoneNumber,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR},
#{departmentId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{clerkCode,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{clerkCode,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{headImg})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated" >
insert into tab_haoban_staff_department_related insert into tab_haoban_staff_department_related
...@@ -70,6 +71,9 @@ ...@@ -70,6 +71,9 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time, update_time,
</if> </if>
<if test="headImg != null" >
head_img,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="staffDepartmentRelatedId != null" > <if test="staffDepartmentRelatedId != null" >
...@@ -102,6 +106,9 @@ ...@@ -102,6 +106,9 @@
<if test="updateTime != null" > <if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="headImg != null" >
#{headImg,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated" > <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated" >
...@@ -134,6 +141,9 @@ ...@@ -134,6 +141,9 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="headImg != null" >
head_img = #{headImg,jdbcType=VARCHAR},
</if>
</set> </set>
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR} where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update> </update>
...@@ -146,6 +156,7 @@ ...@@ -146,6 +156,7 @@
department_id = #{departmentId,jdbcType=VARCHAR}, department_id = #{departmentId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
clerk_code = #{clerkCode,jdbcType=VARCHAR}, clerk_code = #{clerkCode,jdbcType=VARCHAR},
head_img = #{headImg,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR} where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
......
...@@ -33,8 +33,16 @@ public class StaffController extends WebBaseController{ ...@@ -33,8 +33,16 @@ public class StaffController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10005); return resultResponse(HaoBanErrCode.ERR_10005);
} }
HaobanResponse hr = staffApiService.add(staff,departmentIds); HaobanResponse hr = staffApiService.add(staff,departmentIds);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("staff-sel")
public HaobanResponse staffSel(String staffId,String staffDepartmentRelatedId){
StaffDTO staff = staffApiService.selectById(staffId);
// HaobanResponse hr = staffApiService.add(staff,departmentIds);
return resultResponse(HaoBanErrCode.ERR_1);
} }
} }
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