Commit c0905dad by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !5
parents da45a584 cd1417b2
......@@ -7,10 +7,12 @@ package com.gic.store.constant;
public enum CreateTypeEnum {
BACKGROUND_ADD(1, "后台新增"),
BATCH_IMPORT(2, "批量导入"),
ORDER(3, "订单生成"),
ERP(4, "erp同步"),
ORDER(3, "增量订单同步"),
ERP(4, "ERP同步"),
API(5, "API接口"),
MEMBER(6, "会员生成"),
MEMBER(6, "增量会员同步"),
BULKORDER(7, "批量订单同步"),
BULKMEMBER(8, "批量会员同步")
;
......
......@@ -72,6 +72,7 @@ public class ClerkDTO implements Serializable {
private Integer operatorId;
private String operatorName;
private String storeName;
private String haobanStatusName;
public Integer getClerkId() {
......@@ -201,4 +202,12 @@ public class ClerkDTO implements Serializable {
public void setHaobanStatus(Integer haobanStatus) {
this.haobanStatus = haobanStatus;
}
public void setHaobanStatusName(String haobanStatusName) {
this.haobanStatusName = haobanStatusName;
}
public String getHaobanStatusName() {
return haobanStatusName;
}
}
......@@ -13,7 +13,7 @@ public class ClerkSearchDTO implements Serializable {
private static final long serialVersionUID = 7888454039825986790L;
private String search;
private Integer storeGroupId;
private String selectJson;
private String searchJson;
private Integer enterpriseId;
private String storeIds;
private Integer currentPage=1;
......@@ -41,12 +41,12 @@ public class ClerkSearchDTO implements Serializable {
this.storeGroupId = storeGroupId;
}
public String getSelectJson() {
return selectJson;
public String getSearchJson() {
return searchJson;
}
public void setSelectJson(String selectJson) {
this.selectJson = selectJson;
public void setSearchJson(String searchJson) {
this.searchJson = searchJson;
}
public void setEnterpriseId(Integer enterpriseId) {
......
......@@ -48,6 +48,7 @@ public class StoreDTO extends StoreInfoDTO implements Serializable {
private String remark;
private Integer operatorId;
private String operatorName;
private Integer license = Integer.MAX_VALUE;
/**
* 小程序默认图片
*/
......@@ -188,4 +189,12 @@ public class StoreDTO extends StoreInfoDTO implements Serializable {
public StorePhotoDTO getDefaultPhoto() {
return defaultPhoto;
}
public Integer getLicense() {
return license;
}
public void setLicense(Integer license) {
this.license = license;
}
}
\ No newline at end of file
......@@ -17,5 +17,5 @@ public interface DictApiService {
* @return com.gic.store.entity.TabGicDict
* @throws
*/
ServiceResponse<GicDictDTO> getDictByCode(String dictType, String dictValue);
ServiceResponse<GicDictDTO> getDictByCode(String dictType, String dictCode);
}
......@@ -53,8 +53,14 @@ public interface StoreWidgetApiService {
*/
ServiceResponse<Page<StoreDTO>> listStoreByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId, int pageNum, int pageSize);
ServiceResponse<Page<Integer>> listStoreIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId, int pageNum, int pageSize);
ServiceResponse<Page<Integer>> listStoreInfoIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId, int pageNum, int pageSize);
ServiceResponse<List<Integer>> listStoreIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId);
ServiceResponse<List<Integer>> listStoreInfoIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId);
/** @Description: 判断门店是否在门店控件里
* @author taogs
......
......@@ -52,5 +52,5 @@ public interface DictMapper {
*/
int updateByPrimaryKey(TabGicDict record);
TabGicDict getDictByCode(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
TabGicDict getDictByCode(@Param("dictType") String dictType, @Param("dictCode") String dictCode);
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ public class DictServiceImpl implements DictService {
@Override
public TabGicDict getDictByCode(String dictType, String dictValue) {
return dictMapper.getDictByCode(dictType, dictValue);
public TabGicDict getDictByCode(String dictType, String dictCode) {
return dictMapper.getDictByCode(dictType, dictCode);
}
}
......@@ -60,9 +60,13 @@ public class StoreServiceImpl implements StoreService {
tabStoreInfo.setLongitude(copy.getLongitude());
tabStoreInfo.setLatitude(copy.getLatitude());
tabStoreInfo.setCompleteStatus(copy.getCompleteStatus());
// TODO 这里要判断一下总量
tabStoreInfo.setOverflowStatus(0);
// 这里要判断一下总量
Integer count = this.countByStoreName(copy.getEnterpriseId(), "", null);
if(count >= copy.getLicense()){
tabStoreInfo.setOverflowStatus(1);
}else {
tabStoreInfo.setOverflowStatus(0);
}
tabStoreInfo.setStatus(copy.getStatus());
tabStoreInfo.setErpStatus(copy.getErpStatus());
tabStoreInfo.setStoreType(copy.getStoreType());
......
......@@ -65,4 +65,8 @@ public class StoreWidgetServiceImpl implements StoreWidgetService {
storeWidget.setStoreWidgetId(storeWidgetDTO.getStoreWidgetId());
return this.tabStoreWidgetMapper.updateByPrimaryKeySelective(storeWidget);
}
public static void main(String[] args){
System.out.println(Integer.MAX_VALUE);
}
}
......@@ -181,9 +181,9 @@ public class ClerkApiServiceImpl implements ClerkApiService {
// 查询条件对应的storeId
String storeIdByClerkSearch;
if (StringUtils.isNotBlank(clerkSearchDTO.getSearch())) {
List<Integer> storeInfoIdsBySearch = clerkService.getStoreInfoIdsBySearch(enterpriseId, null);
List<Integer> storeInfoIdsBySearch = clerkService.getStoreInfoIdsBySearch(enterpriseId, clerkSearchDTO.getSearch());
if (CollectionUtils.isEmpty(groupIds) || CollectionUtils.isEmpty(storeInfoIdsBySearch)) {
storeIdByClerkSearch = "";
return ServiceResponse.success(new Page<>());
} else {
storeIdByClerkSearch = getStoreIdByStoreInfoIds(storeInfoIdsBySearch, null);
}
......@@ -237,8 +237,12 @@ public class ClerkApiServiceImpl implements ClerkApiService {
@Override
public ServiceResponse<Integer> getTotalClerk(Integer enterpriseId, ClerkSearchDTO clerkSearchDTO) {
if (clerkSearchDTO.getStoreGroupId() == null) {
return ServiceResponse.failure(ErrorCode.MISS_PARAMETER.getCode(), ErrorCode.MISS_PARAMETER.getMsg());
boolean hasStoreIds = StringUtils.isNotBlank(clerkSearchDTO.getStoreIds());
//如果有门店数据条件,则不判断门店分组数据,因为分店分组数据也是为了获取门店
if (!hasStoreIds) {
if (clerkSearchDTO.getStoreGroupId() == null) {
return ServiceResponse.failure(ErrorCode.MISS_PARAMETER.getCode(), ErrorCode.MISS_PARAMETER.getMsg());
}
}
// 分组的id
List<TabStoreGroup> groupList = storeGroupService.listStoreGroupAndChildren(clerkSearchDTO.getStoreGroupId());
......@@ -246,18 +250,19 @@ public class ClerkApiServiceImpl implements ClerkApiService {
// 查询条件对应的storeId
String storeIdByClerkSearch;
if (StringUtils.isNotBlank(clerkSearchDTO.getSearch())) {
List<Integer> storeInfoIdsBySearch = clerkService.getStoreInfoIdsBySearch(enterpriseId,
clerkSearchDTO.getSearch());
List<Integer> storeInfoIdsBySearch = clerkService.getStoreInfoIdsBySearch(enterpriseId, clerkSearchDTO.getSearch());
if (CollectionUtils.isEmpty(groupIds) || CollectionUtils.isEmpty(storeInfoIdsBySearch)) {
storeIdByClerkSearch = "";
} else {
storeIdByClerkSearch = getStoreIdByStoreInfoIds(storeInfoIdsBySearch, clerkSearchDTO.getSearch());
storeIdByClerkSearch = getStoreIdByStoreInfoIds(storeInfoIdsBySearch, null);
}
} else {
storeIdByClerkSearch = "";
}
clerkSearchDTO.setEnterpriseId(enterpriseId);
clerkSearchDTO.setStoreIds(storeIdByClerkSearch);
if (!hasStoreIds) {
clerkSearchDTO.setStoreIds(storeIdByClerkSearch);
}
ServiceResponse<Page<StoreDTO>> serviceResponse = listStoreIds(clerkSearchDTO, 1, Integer.MAX_VALUE);
if (!serviceResponse.isSuccess()) {
return ServiceResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......@@ -273,6 +278,19 @@ public class ClerkApiServiceImpl implements ClerkApiService {
return ServiceResponse.success(totalClerk);
}
// private String getStoreIdByStoreInfoIds(List<Integer> storeInfoIdsBySearch, String search) {
// StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
// storeSearchDTO.setStoreInfoIds(StringUtils.join(storeInfoIdsBySearch, " "));
// storeSearchDTO.setSearch(search);
// Page<StoreDTO> page = storeApiService.listStore(storeSearchDTO, 1, Integer.MAX_VALUE).getResult();
// if (page == null) {
// return "";
// } else {
// return Optional.ofNullable(page.getResult()).orElse(Collections.emptyList()).stream().map(e -> e.getStoreId().toString())
// .reduce((x, y) -> x + " " + y).orElse("");
// }
// }
private String getStoreIdByStoreInfoIds(List<Integer> storeInfoIdsBySearch, String search) {
StoreSearchDBDTO storeSearchDBDTO = new StoreSearchDBDTO();
storeSearchDBDTO.setStoreInfoIdList(storeInfoIdsBySearch);
......@@ -282,15 +300,15 @@ public class ClerkApiServiceImpl implements ClerkApiService {
.reduce((x, y) -> x + " " + y).orElse("");
}
@SuppressWarnings("unchecked")
private ServiceResponse<Page<StoreDTO>> listStoreIds(ClerkSearchDTO clerkSearchDTO, Integer pageNum,
Integer pageSize) {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(clerkSearchDTO.getEnterpriseId());
storeSearchDTO.setStoreGroupId(clerkSearchDTO.getStoreGroupId());
storeSearchDTO.setSearchJson(clerkSearchDTO.getSelectJson());
storeSearchDTO.setSearchJson(clerkSearchDTO.getSearchJson());
storeSearchDTO.setStoreIds(clerkSearchDTO.getStoreIds());
// storeSearchDTO.setSearch(clerkSearchDTO.getSearch());
return storeApiService.listStore(storeSearchDTO, pageNum, pageSize,
"storeId,storeName,storeCode,storeInfoId,ownType");
......
......@@ -22,8 +22,8 @@ public class DictApiServiceImpl implements DictApiService {
private DictService dictService;
@Override
public ServiceResponse<GicDictDTO> getDictByCode(String dictType, String dictValue) {
TabGicDict dict = dictService.getDictByCode(dictType, dictValue);
public ServiceResponse<GicDictDTO> getDictByCode(String dictType, String dictCode) {
TabGicDict dict = dictService.getDictByCode(dictType, dictCode);
GicDictDTO gicDictDTO = EntityUtil.changeEntityByJSON(GicDictDTO.class, dict);
return EnterpriseServiceResponse.success(gicDictDTO);
}
......
......@@ -8,6 +8,7 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.*;
import com.gic.enterprise.dto.CustomStoreDTO;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.EnterpriseLicenseDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.enterprise.service.CustomStoreApiService;
......@@ -147,6 +148,12 @@ public class StoreApiServiceImpl implements StoreApiService {
getStatus(storeDTO);
if (storeDTO.getStoreId() == null) {
ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense = this.enterpriseApiService.listEnterpriseLicense(storeDTO.getEnterpriseId());
if(listEnterpriseLicense.isSuccess() && CollectionUtils.isNotEmpty(listEnterpriseLicense.getResult())){
if(listEnterpriseLicense.getResult().size()== 4){
storeDTO.setLicense(listEnterpriseLicense.getResult().get(3).getUpperLimit());
}
}
Integer id = storeService.save(storeDTO);
storeDTO.setStoreId(id);
// 记录门店日志
......@@ -198,6 +205,7 @@ public class StoreApiServiceImpl implements StoreApiService {
storeDTO.setStoreCode(storeCode);
storeDTO.setStoreName(storeName);
storeDTO.setRegionId(regionId);
storeDTO.setCreateType(CreateTypeEnum.ORDER.getCode());
return this.saveOrUpdate(storeDTO);
}
......@@ -650,20 +658,19 @@ public class StoreApiServiceImpl implements StoreApiService {
@Override
public ServiceResponse<Page<StoreDTO>> pageCoupApplyStore(WxSearchStoreSearchDTO coupApplyStoreSearchDTO) {
Integer storeWidgetId = coupApplyStoreSearchDTO.getStoreWidgetId();
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(coupApplyStoreSearchDTO.getEnterpriseId());
storeSearchDTO.setStoreBrandId(coupApplyStoreSearchDTO.getBrandId());
storeSearchDTO.setLongitude(coupApplyStoreSearchDTO.getLongitude());
storeSearchDTO.setLatitude(coupApplyStoreSearchDTO.getLatitude());
storeSearchDTO.setCityId(coupApplyStoreSearchDTO.getCityId());
if(coupApplyStoreSearchDTO.getStoreWidgetId() != null){
Integer storeWidgetId = coupApplyStoreSearchDTO.getStoreWidgetId();
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(coupApplyStoreSearchDTO.getEnterpriseId());
storeSearchDTO.setStoreBrandId(coupApplyStoreSearchDTO.getBrandId());
storeSearchDTO.setLongitude(coupApplyStoreSearchDTO.getLongitude());
storeSearchDTO.setLatitude(coupApplyStoreSearchDTO.getLatitude());
storeSearchDTO.setCityId(coupApplyStoreSearchDTO.getCityId());
storeSearchDTO.setStoreResource(Long.valueOf(storeWidgetId+""));
ServiceResponse<Page<StoreDTO>> storePage = this.listStore(storeSearchDTO, coupApplyStoreSearchDTO.getPageNum(), coupApplyStoreSearchDTO.getPageSize());
logger.info("pageCoupApplyStore:{}", JSON.toJSONString(storePage, true));
return ServiceResponse.success(storePage.getResult());
}
return ServiceResponse.success();
ServiceResponse<Page<StoreDTO>> storePage = this.listStore(storeSearchDTO, coupApplyStoreSearchDTO.getPageNum(), coupApplyStoreSearchDTO.getPageSize());
logger.info("pageCoupApplyStore:{}", JSON.toJSONString(storePage, true));
return ServiceResponse.success(storePage.getResult());
}
@Override
......@@ -814,6 +821,7 @@ public class StoreApiServiceImpl implements StoreApiService {
storeDTO.setLongitude(processBatchStoreDTO.getLongitude());
storeDTO.setLatitude(processBatchStoreDTO.getLatitude());
storeDTO.setReason(StoreLogReasonEnum.ETL.getCode());
storeDTO.setCreateType(CreateTypeEnum.ERP.getCode());
// 保存门店
// this.storeService.save(storeDTO);
ServiceResponse<Integer> serviceResponse = this.saveOrUpdate(storeDTO);
......@@ -1190,8 +1198,8 @@ public class StoreApiServiceImpl implements StoreApiService {
private DynamicDocDTO buildStoreDocDto(Integer enterpriseId, Integer storeId) {
refreshCache(enterpriseId, storeId);
ServiceResponse<StoreDTO> response = this.getStoreById(enterpriseId, storeId);
if (response.isSuccess()) {
StoreDTO dto = response.getResult();
StoreDTO dto = response.getResult();
if (response.isSuccess() && dto != null && dto.getOverflowStatus() != 1) {
StoreEsDTO esDTO = new StoreEsDTO();
esDTO.setAreaIds(Arrays.asList(dto.getProvinceId(), dto.getCityId(), dto.getAreaId()));
esDTO.setCityId(dto.getCityId());
......
......@@ -158,6 +158,10 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
//刷新缓存
refreshRedisCache(storeGroupId);
List<StoreGroupDTO> listChidrend = this.listStoreGroupAndChildren(storeGroupParentId).getResult();
for(StoreGroupDTO dto : listChidrend){
this.storeApiService.refreshStoreIndex(storeGroupDTO.getEnterpriseId(), dto.getStoreGroupId());
}
}
} else {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "一级分组不需要修改上级分组");
......@@ -303,10 +307,7 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
if (tabStoreGroup == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "主键错误,查询不到数据");
}
ServiceResponse<TabStoreGroup> authValid = validIsDefault(storeGroupId);
if (!authValid.isSuccess()) {
return ServiceResponse.failure(authValid.getCode(), authValid.getMessage());
}
if (setSortValue == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "拖拽排序值不能为空");
}
......
......@@ -4,6 +4,7 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.store.constant.StoreESFieldsEnum;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreSearchDTO;
import com.gic.store.dto.StoreWidgetDTO;
......@@ -88,6 +89,62 @@ public class StoreWidgetApiServiceImpl implements StoreWidgetApiService {
}
@Override
public ServiceResponse<Page<Integer>> listStoreIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId, int pageNum, int pageSize) {
StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidget(storeWidgetId);
if(storeWidgetDTO != null){
String authSearchParam = storeWidgetDTO.getAuthSearchParam();
String searchParam = storeWidgetDTO.getSearchParam();
StoreSearchDTO dto = new StoreSearchDTO();
dto.setEnterpriseId(enterpriseId);
if(StringUtils.isNotBlank(authSearchParam) && !"{}".equals(authSearchParam)){
dto.setAuthSearchJson(authSearchParam);
}
dto.setSearchJson(searchParam);
ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(dto, pageNum, pageSize,
StoreESFieldsEnum.STOREID.getField() + "");
Page<Integer> page = new Page<>(pageNum, pageSize);
List<Integer> list = new ArrayList<>();
if(response.getResult() != null){
page.setTotalCount(response.getResult().getTotalCount());
for(StoreDTO storeDTO : response.getResult().getResult()){
list.add(storeDTO.getStoreId());
}
}
page.setResult(list);
return ServiceResponse.success(page);
}
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "门店控件id不存在");
}
@Override
public ServiceResponse<Page<Integer>> listStoreInfoIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId, int pageNum, int pageSize) {
StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidget(storeWidgetId);
if(storeWidgetDTO != null){
String authSearchParam = storeWidgetDTO.getAuthSearchParam();
String searchParam = storeWidgetDTO.getSearchParam();
StoreSearchDTO dto = new StoreSearchDTO();
dto.setEnterpriseId(enterpriseId);
if(StringUtils.isNotBlank(authSearchParam) && !"{}".equals(authSearchParam)){
dto.setAuthSearchJson(authSearchParam);
}
dto.setSearchJson(searchParam);
ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(dto, pageNum, pageSize,
StoreESFieldsEnum.STOREINFOID.getField() + "");
Page<Integer> page = new Page<>(pageNum, pageSize);
List<Integer> list = new ArrayList<>();
if(response.getResult() != null){
page.setTotalCount(response.getResult().getTotalCount());
for(StoreDTO storeDTO : response.getResult().getResult()){
list.add(storeDTO.getStoreInfoId());
}
}
page.setResult(list);
return ServiceResponse.success(page);
}
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "门店控件id不存在");
}
@Override
public ServiceResponse<List<Integer>> listStoreIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId) {
List<Integer> list = new ArrayList<>();
this.getStoreId(enterpriseId, storeWidgetId, 1, list);
......@@ -95,6 +152,13 @@ public class StoreWidgetApiServiceImpl implements StoreWidgetApiService {
}
@Override
public ServiceResponse<List<Integer>> listStoreInfoIdByStoreWidgetId(Integer enterpriseId, Integer storeWidgetId) {
List<Integer> list = new ArrayList<>();
this.getStoreInfoId(enterpriseId, storeWidgetId, 1, list);
return ServiceResponse.success(list);
}
@Override
public ServiceResponse exist(Integer enterpriseId, Integer storeWidgetId, Integer storeId) {
StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidget(storeWidgetId);
if(storeWidgetDTO != null){
......@@ -121,12 +185,10 @@ public class StoreWidgetApiServiceImpl implements StoreWidgetApiService {
}
private void getStoreId(Integer enterpriseId, Integer storeWidgetId, int pageNum, List<Integer> list){
ServiceResponse<Page<StoreDTO>> response = this.listStoreByStoreWidgetId(enterpriseId, storeWidgetId, pageNum, 10000);
ServiceResponse<Page<Integer>> response = this.listStoreIdByStoreWidgetId(enterpriseId, storeWidgetId, pageNum, 10000);
if(response.isSuccess() && response.getResult() != null){
Page<StoreDTO> page = response.getResult();
for(StoreDTO dto : page.getResult()){
list.add(dto.getStoreId());
}
Page<Integer> page = response.getResult();
list.addAll(page.getResult());
if(pageNum == 1 && page.getPages() > 1){
for(int i=2; i<= page.getPages(); i++){
this.getStoreId(enterpriseId, storeWidgetId, i, list);
......@@ -134,4 +196,17 @@ public class StoreWidgetApiServiceImpl implements StoreWidgetApiService {
}
}
}
private void getStoreInfoId(Integer enterpriseId, Integer storeWidgetId, int pageNum, List<Integer> list){
ServiceResponse<Page<Integer>> response = this.listStoreInfoIdByStoreWidgetId(enterpriseId, storeWidgetId, pageNum, 10000);
if(response.isSuccess() && response.getResult() != null){
Page<Integer> page = response.getResult();
list.addAll(page.getResult());
if(pageNum == 1 && page.getPages() > 1){
for(int i=2; i<= page.getPages(); i++){
this.getStoreInfoId(enterpriseId, storeWidgetId, i, list);
}
}
}
}
}
......@@ -130,6 +130,6 @@
<include refid="Base_Column_List" />
from tab_gic_dict
where
dict_type = #{dictType} and dict_value = #{dictValue}
dict_type = #{dictType} and dict_code = #{dictCode}
</select>
</mapper>
\ No newline at end of file
......@@ -348,7 +348,7 @@
and (t1.store_name like concat('%', #{store.search}, '%') or t1.store_code like concat('%', #{store.search}, '%'))
</if>
<if test="store.storeCode != null and store.storeCode !=''">
and t1.store_code like concat('%', #{store.storeCode}, '%')
and t1.store_code =#{store.storeCode}
</if>
<if test="store.storeName != null and store.storeName != ''">
and t1.store_name like concat('%', #{store.storeName}, '%')
......
......@@ -133,6 +133,7 @@ public class ClerkController extends DownloadUtils {
List<ClerkDTO> clerkList = clerkStoreListDTO.getClerkList();
for (ClerkDTO clerkDTO : clerkList) {
clerkDTO.setStoreName(clerkStoreListDTO.getStoreName());
clerkDTO.setHaobanStatusName(clerkDTO.getHaobanStatus() == null ? null : (clerkDTO.getHaobanStatus() == 1 ? "已绑定" : "未绑定"));
}
clerkDTOS.addAll(clerkList);
}
......@@ -222,7 +223,7 @@ public class ClerkController extends DownloadUtils {
clerkDTO.setOperatorName(UserDetailUtils.getUserDetail().getUserInfo().getUserName());
ServiceResponse serviceResponse = clerkApiService.saveOrUpdate(clerkDTO);
if (serviceResponse.isSuccess()) {
LogUtils.createLog((clerkQO.getClerkId() == null ? "新增" : "修改") + "导购", clerkQO.getClerkName());
LogUtils.createLog((clerkQO.getClerkId() == null ? "新增" : "编辑") + "导购", clerkQO.getClerkName());
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......@@ -302,7 +303,7 @@ public class ClerkController extends DownloadUtils {
clerkName("clerkName", "店员名称", 0),
positionName("positionName", "职位", 0),
phoneNumber("phoneNumber", "手机号", 1),
haobanStatus("haobanStatus", "好办状态", 0);
haobanStatusName("haobanStatusName", "好办状态", 0);
;
private String fieldCode;
......
......@@ -125,6 +125,8 @@ public class ClerkImportController {
return RestResponse.failure(ErrorCode.OPERATION_FAILED.getCode(), "总列数与模板不一致");
}
clerkImportApiService.delClerkTmp(enterpriseId);
int logCount = 0;
StringBuilder sb = new StringBuilder();
for (Map<Integer, String> row : data) {
ClerkTmpDTO bean = this.validateData(row, enterpriseId);
try {
......@@ -136,7 +138,17 @@ public class ClerkImportController {
} catch (Exception e) {
logger.warn(e);
}
if (logCount <= 3) {
sb.append(bean.getStoreName()).append(",");
}
logCount++;
}
if (sb.length() > 0 && logCount > 0) {
sb.deleteCharAt(sb.length() - 1);
sb.append("等").append(logCount).append("名导购");
}
LogUtils.createLog("批量导入", sb.toString());
if (clerkImportApiService.hasImportingClerk(enterpriseId).getResult()) {
// 开队列
......
......@@ -34,6 +34,7 @@ import com.gic.store.web.vo.StoreListSourceVO;
import com.gic.store.web.vo.StoreOverflowVO;
import com.gic.wechat.business.api.service.fwh.WeixinBaseFunService;
import com.gic.wechat.business.api.service.wxa.WeixinWxaFunService;
import com.google.common.base.Joiner;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -122,7 +123,7 @@ public class StoreController extends DownloadUtils {
storeDTO.setOperatorName(UserDetailUtils.getUserDetail().getUserInfo().getUserName());
ServiceResponse<Integer> serviceResponse = storeApiService.saveOrUpdate(storeDTO);
if (serviceResponse.isSuccess()) {
LogUtils.createLog((storeQO.getStoreId() == null ? "新增" : "修改") + "门店", storeQO.getStoreName());
LogUtils.createLog((storeQO.getStoreId() == null ? "新增" : "编辑") + "门店", storeQO.getStoreName());
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......@@ -302,6 +303,29 @@ public class StoreController extends DownloadUtils {
}
ServiceResponse response = this.storeApiService.bulkUpdateStore(storeIds, value, enterpriseId, type, UserDetailUtils.getUserDetail().getUserId(), UserDetailUtils.getUserDetail().getUserInfo().getUserName());
if (response.isSuccess()) {
String[] storeArr = storeIds.split(",");
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreIds(Joiner.on(" ").join(storeArr));
Page<StoreDTO> page = this.storeApiService.listStore(storeSearchDTO, 1, 3).getResult();
if (page != null && CollectionUtils.isNotEmpty(page.getResult())) {
List<StoreDTO> storeList = page.getResult();
if (CollectionUtils.isNotEmpty(storeList)) {
String storeName = storeList.stream().map(StoreDTO::getStoreName).reduce((x, y) -> x + "," + y).get();
if (storeArr.length > 3) {
storeName += "等" + storeArr.length + "家门店";
}
String content;
if (type == 1) {
content = "修改启用状态";
} else if (type == 7) {
content = "批量修改分组";
} else {
content = "批量编辑";
}
LogUtils.createLog(content, storeName);
}
}
return RestResponse.success();
}
return EnterpriseRestResponse.failure(response);
......@@ -445,6 +469,11 @@ public class StoreController extends DownloadUtils {
logger.info("transfer-store-member:{}", JSON.toJSONString(storeBatchUpdateDTO));
ServiceResponse<Void> response = this.storeUpdateApiService.storeBatchUpdate(storeBatchUpdateDTO);
logger.info("transfer-store-member-result:{}", JSON.toJSONString(response));
StoreDTO storeDTO = storeApiService.getStoreById(UserDetailUtils.getUserDetail().getEnterpriseId(), storeId).getResult();
if (storeDTO != null) {
LogUtils.createLog("会员处理", storeDTO.getStoreName());
}
return EnterpriseRestResponse.failure(response);
}
......
......@@ -160,9 +160,9 @@ public class StoreDictController {
String key = "relevanceStorefield:"+enterpriseId;
Object cache = RedisUtil.getCache(key);
if(cache != null){
//return RestResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "请稍后重试");
return RestResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "请稍后重试");
}
AuditLogDTO auditLogDTO = new AuditLogDTO();
/*AuditLogDTO auditLogDTO = new AuditLogDTO();
auditLogDTO.setEnterpriseId(1129);
auditLogDTO.setApplyUserId(124);
auditLogDTO.setProjectItemCode(Constants.PROJECT_ITEM_RISK_MODE_APPLY);
......@@ -172,7 +172,7 @@ public class StoreDictController {
jsonObject.put("values", values);
jsonObject.put("userId", userId);
auditLogDTO.setExtraInfo(jsonObject.toJSONString());
auditLogApiService.apply(auditLogDTO);
auditLogApiService.apply(auditLogDTO);*/
RedisUtil.setCache(key, 1, 12l, TimeUnit.HOURS);
ServiceResponse serviceResponse = this.storeDictApiService.saveStoreField(enterpriseId, values, userId);
if(serviceResponse.isSuccess()){
......
......@@ -147,6 +147,8 @@ public class StoreImportController {
//重置临时表数据
storeImportApiService.delStoreTmp(enterpriseId);
//批量插入数据到门店临时表,用于队列导入到门店表
int logCount = 0;
StringBuilder sb = new StringBuilder();
for (Map<Integer, String> row : data) {
StoreTmpDTO bean = this.validateData(row, enterpriseId, storeRegion.getRegionId(), isReplace);
bean.setRegionId(storeRegion.getRegionId());
......@@ -160,7 +162,17 @@ public class StoreImportController {
} catch (Exception e) {
logger.warn(e);
}
if (logCount <= 3) {
sb.append(bean.getStoreName()).append(",");
}
logCount++;
}
if (sb.length() > 0 && logCount > 0) {
sb.deleteCharAt(sb.length() - 1);
sb.append("等").append(logCount).append("家门店");
}
LogUtils.createLog("批量导入", sb.toString());
if (storeImportApiService.hasImportingStore(enterpriseId).getResult()) {
// userId
......@@ -191,7 +203,6 @@ public class StoreImportController {
} else {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "选择xlsx格式文件上传");
}
LogUtils.createLog("导入门店", "门店");
return RestResponse.success();
}
......
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