Commit f676b335 by qwmqiuwenmin

fix

parent 9945798f
...@@ -79,4 +79,8 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -79,4 +79,8 @@ public interface TabHaobanStaffClerkRelationMapper {
void delByClerkId(@Param("clerkId")String clerkId); void delByClerkId(@Param("clerkId")String clerkId);
List<TabHaobanStaffClerkRelation>listByEnterpriseIdAndWxUserId(@Param("enterpriseId")String enterpriseId,@Param("wxUserId")String wxUserId); 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 { ...@@ -55,4 +55,6 @@ public interface StaffClerkRelationService {
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList); List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList);
List<StaffClerkRelationDTO> lisByStaffId(String wxEnterpriseId, String staffId);
} }
...@@ -112,4 +112,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -112,4 +112,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
} }
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class,mapper.listByClerkIds(clerkList)); 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; ...@@ -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.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; 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.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -52,6 +54,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -52,6 +54,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired @Autowired
private AuditApiService auditApiService; private AuditApiService auditApiService;
@Autowired
private ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Override @Override
...@@ -140,6 +145,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -140,6 +145,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
staffClerkRelatinService.bind(staffClerkRelationDTO); staffClerkRelatinService.bind(staffClerkRelationDTO);
//设置主门店
setMainStore(staffClerkRelationDTO);
return response; return response;
} }
...@@ -149,12 +156,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -149,12 +156,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@Override @Override
public String insert(StaffClerkRelationDTO staffClerkRelation) { public String insert(StaffClerkRelationDTO staffClerkRelation) {
return staffClerkRelatinService.insert(staffClerkRelation); String uuId = staffClerkRelatinService.insert(staffClerkRelation);
//设置主门店
setMainStore(staffClerkRelation);
return uuId;
} }
@Override @Override
public void insertOrUpdate(StaffClerkRelationDTO staffClerkRelation) { public void insertOrUpdate(StaffClerkRelationDTO staffClerkRelation) {
if(StringUtils.isEmpty(staffClerkRelation.getStaffClerkRelationId())){ if(StringUtils.isEmpty(staffClerkRelation.getStaffClerkRelationId())){
staffClerkRelatinService.insert(staffClerkRelation); staffClerkRelatinService.insert(staffClerkRelation);
//设置主门店
setMainStore(staffClerkRelation);
}else{ }else{
TabHaobanStaffClerkRelation tab = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation); TabHaobanStaffClerkRelation tab = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation);
tabHaobanStaffClerkRelationMapper.updateByPrimaryKeySelective(tab); tabHaobanStaffClerkRelationMapper.updateByPrimaryKeySelective(tab);
...@@ -162,7 +174,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -162,7 +174,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@Override @Override
public String delByStoreIdAndCode(String storeId, String clerkCode) { public String delByStoreIdAndCode(String storeId, String clerkCode) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getByCodeAndStoreId(clerkCode, storeId);
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode); tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode);
delSetMainStore(staffClerkRelation);
return null; return null;
} }
@Override @Override
...@@ -189,7 +203,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -189,7 +203,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId) { public boolean unbindByStaffAndClerkId(String staffId, String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
boolean b = staffClerkRelatinService.delBind(clerkId); boolean b = staffClerkRelatinService.delBind(clerkId);
delSetMainStore(staffClerkRelation);
return b; return b;
} }
@Override @Override
...@@ -219,15 +235,37 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -219,15 +235,37 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}else{ }else{
tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId()); tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
staffClerkRelatinService.insert(staffClerkRelation); staffClerkRelatinService.insert(staffClerkRelation);
} }
//设置主门店
setMainStore(staffClerkRelation);
} }
@Override @Override
public void delByClerkId(String clerkId) { public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId); tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation);
} }
@Override @Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndWxUserId(String enterpriseId,String wxUserId) { public List<StaffClerkRelationDTO> listByEnterpriseIdAndWxUserId(String enterpriseId,String wxUserId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndWxUserId(enterpriseId,wxUserId); List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndWxUserId(enterpriseId,wxUserId);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list); 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 @@ ...@@ -338,4 +338,26 @@
and wx_user_id = #{wxUserId} and wx_user_id = #{wxUserId}
</select> </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> </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