Limit client sku association to active clients

pull/8523/head
Qiuyi LI 2025-05-15 16:28:09 +02:00
parent 6c79152c89
commit d51d68abb9
6 changed files with 13 additions and 2 deletions

View File

@ -20,6 +20,7 @@ public interface ClientMapper extends BaseMapper<Client> {
String getClientEntity(@Param("id") String id); String getClientEntity(@Param("id") String id);
Map<String, String> getClientsEntity(@Param("ids") List<String> ids); Map<String, String> getClientsEntity(@Param("ids") List<String> ids);
String getClientIdByCode(@Param("code") String code); String getClientIdByCode(@Param("code") String code);
String getActiveClientIdByCode(@Param("code") String code);
List<Client> getClientByType(@Param("type") String type); List<Client> getClientByType(@Param("type") String type);
Client getClientByCode(@Param("code") String internalCode); Client getClientByCode(@Param("code") String internalCode);
Client getClientFromOrder(@Param("orderId")String orderId); Client getClientFromOrder(@Param("orderId")String orderId);

View File

@ -23,6 +23,11 @@
SELECT * SELECT *
FROM client FROM client
WHERE internal_code = #{code} WHERE internal_code = #{code}
</select>
<select id="getActiveClientByCode" parameterType="java.lang.String" resultType="org.jeecg.modules.business.entity.Client">
SELECT *
FROM client
WHERE internal_code = #{code} AND active = 1
</select> </select>
<select id="getClientByType" resultType="org.jeecg.modules.business.entity.Client"> <select id="getClientByType" resultType="org.jeecg.modules.business.entity.Client">
SELECT c.* SELECT c.*

View File

@ -41,6 +41,7 @@ public interface IClientService extends IService<Client> {
public String getClientEntity(String id); public String getClientEntity(String id);
public Map<String, String> getClientsEntity(List<String> ids); public Map<String, String> getClientsEntity(List<String> ids);
public String getClientIdByCode(String code); public String getClientIdByCode(String code);
public String getActiveClientIdByCode(String code);
/** /**
* Get current user's client information * Get current user's client information
* @return client or null if current user's role is not client * @return client or null if current user's role is not client

View File

@ -161,6 +161,10 @@ public class ClientServiceImpl extends ServiceImpl<ClientMapper, Client> impleme
public String getClientIdByCode(String code) { public String getClientIdByCode(String code) {
return clientMapper.getClientIdByCode(code); return clientMapper.getClientIdByCode(code);
} }
@Override
public String getActiveClientIdByCode(String code) {
return clientMapper.getActiveClientIdByCode(code);
}
@Override @Override
public void anonymizePersonalData(int directClientAnonymizationPeriod) { public void anonymizePersonalData(int directClientAnonymizationPeriod) {

View File

@ -49,7 +49,7 @@ public class ClientSkuServiceImpl extends ServiceImpl<ClientSkuMapper, ClientSku
continue; continue;
} }
String internalCode = erpCode.substring(index+1); String internalCode = erpCode.substring(index+1);
String clientId = clientService.getClientIdByCode(internalCode); String clientId = clientService.getActiveClientIdByCode(internalCode);
if (clientId != null) { if (clientId != null) {
log.info("Associating sku \"{}\" with client \"{}\" : \"{}\". ", sku.getErpCode(), internalCode, clientId); log.info("Associating sku \"{}\" with client \"{}\" : \"{}\". ", sku.getErpCode(), internalCode, clientId);
addClientSku(clientId, sku.getId()); addClientSku(clientId, sku.getId());

View File

@ -410,7 +410,7 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
s.setZhName(skuData.getNameCN()); s.setZhName(skuData.getNameCN());
} }
} }
if(skuData.getStockPicture().equals("") || skuData.getStockPicture() == null) { if(skuData.getStockPicture() == null || skuData.getStockPicture().isEmpty()) {
s.setImageSource(skuData.getSalePicture()); s.setImageSource(skuData.getSalePicture());
} }
else { else {