Commit f676b335 by qwmqiuwenmin

fix

parent 9945798f
......@@ -79,4 +79,8 @@ public interface TabHaobanStaffClerkRelationMapper {
void delByClerkId(@Param("clerkId")String clerkId);
List<TabHaobanStaffClerkRelation>listByEnterpriseIdAndWxUserId(@Param("enterpriseId")String enterpriseId,@Param("wxUserId")String wxUserId);
List<TabHaobanStaffClerkRelation> lisByStaffId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("staffId")String staffId);
TabHaobanStaffClerkRelation getByCodeAndStoreId(String clerkCode, String storeId);
}
\ No newline at end of file
......@@ -55,4 +55,6 @@ public interface StaffClerkRelationService {
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList);
List<StaffClerkRelationDTO> lisByStaffId(String wxEnterpriseId, String staffId);
}
......@@ -112,4 +112,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class,mapper.listByClerkIds(clerkList));
}
@Override
public List<StaffClerkRelationDTO> lisByStaffId(String wxEnterpriseId, String staffId) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.lisByStaffId(wxEnterpriseId, staffId));
}
}
......@@ -18,7 +18,9 @@ import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import org.apache.commons.collections.CollectionUtils;
......@@ -52,6 +54,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired
private AuditApiService auditApiService;
@Autowired
private ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Override
......@@ -140,6 +145,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
staffClerkRelatinService.bind(staffClerkRelationDTO);
//设置主门店
setMainStore(staffClerkRelationDTO);
return response;
}
......@@ -149,12 +156,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public String insert(StaffClerkRelationDTO staffClerkRelation) {
return staffClerkRelatinService.insert(staffClerkRelation);
String uuId = staffClerkRelatinService.insert(staffClerkRelation);
//设置主门店
setMainStore(staffClerkRelation);
return uuId;
}
@Override
public void insertOrUpdate(StaffClerkRelationDTO staffClerkRelation) {
if(StringUtils.isEmpty(staffClerkRelation.getStaffClerkRelationId())){
staffClerkRelatinService.insert(staffClerkRelation);
//设置主门店
setMainStore(staffClerkRelation);
}else{
TabHaobanStaffClerkRelation tab = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation);
tabHaobanStaffClerkRelationMapper.updateByPrimaryKeySelective(tab);
......@@ -162,7 +174,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public String delByStoreIdAndCode(String storeId, String clerkCode) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getByCodeAndStoreId(clerkCode, storeId);
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode);
delSetMainStore(staffClerkRelation);
return null;
}
@Override
......@@ -189,7 +203,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
boolean b = staffClerkRelatinService.delBind(clerkId);
delSetMainStore(staffClerkRelation);
return b;
}
@Override
......@@ -219,15 +235,37 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}else{
tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
staffClerkRelatinService.insert(staffClerkRelation);
}
}
//设置主门店
setMainStore(staffClerkRelation);
}
@Override
public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation);
}
@Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndWxUserId(String enterpriseId,String wxUserId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndWxUserId(enterpriseId,wxUserId);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
}
private void setMainStore(StaffClerkRelationDTO staffClerkRelation){
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
List<StaffClerkRelationDTO> list = staffClerkRelatinService.lisByStaffId(wxEnterpriseId, staffId);
if(list != null && list.size() == 1){
clerkMainStoreRelatedService.setMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
}
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation){
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
List<StaffClerkRelationDTO> list = staffClerkRelatinService.lisByStaffId(wxEnterpriseId, staffId);
if(list != null && list.size() >= 1){
clerkMainStoreRelatedService.setMainStore(staffId, list.get(0).getStoreId(), wxEnterpriseId);
}
}
}
......@@ -338,4 +338,26 @@
and wx_user_id = #{wxUserId}
</select>
<select id="lisByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag = 1
order by create_time desc
</select>
<select id="getByCodeAndStoreId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where
clerk_code = #{clerkCode}
and store_id = #{storeId}
and status_flag = 1
</select>
</mapper>
\ No newline at end of file
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