Commit 9ee1e64c by huangZW

111

parent 7a7bd91c
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class StoreAddressDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String areaId;
private String storeAddress;
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getStoreAddress() {
return storeAddress;
}
public void setStoreAddress(String storeAddress) {
this.storeAddress = storeAddress;
}
}
\ No newline at end of file
......@@ -17,4 +17,6 @@ public interface AuditApiService {
void refuse(String auditId,String auditReason);
int save(Integer auditType,String enterpriseId,String commitStaffId,String commitStoreId,String changeField,String oldValue,String newValue);
void editStoreInfo(String storeId,String changeField,String oldValue, String newValue);
}
package com.gic.haoban.manage.service.service.out.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -11,11 +13,17 @@ import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StorePhotoDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.StoreAddressDTO;
import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
......@@ -36,6 +44,9 @@ public class AuditApiServiceImpl implements AuditApiService{
private DepartmentMapper departmentMapper;
@Autowired
private StaffMapper staffMapper;
@Autowired
private StoreService storeService;
@Override
public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,
String enterpriseId,Integer auditStatus, BasePageInfo pageInfo) {
......@@ -99,4 +110,63 @@ public class AuditApiServiceImpl implements AuditApiService{
tab.setUpdateTime(new Date());
return auditMapper.insertSelective(tab);
}
@Override
public void editStoreInfo(String storeId, String changeField,
String oldValue, String newValue) {
StoreDTO store = storeService.getStore(storeId);
if(!StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){
//非门店图片修改
getStoreDTO( store, changeField, oldValue, newValue);
storeService.saveOrUpdateStore(store);
}else{
//门店图片修改
List<StorePhotoDTO> oldStorePhoto = JSONObject.parseArray(oldValue, StorePhotoDTO.class);
List<StorePhotoDTO> newStorePhoto = JSONObject.parseArray(newValue, StorePhotoDTO.class);
List<String> delPhotos = oldStorePhoto.stream().map(s->s.getImageFiledCode()).collect(Collectors.toList());
storeService.editStoreImage( storeId, newStorePhoto, delPhotos);
}
}
void getStoreDTO(StoreDTO store,String changeField,String oldValue,String newValue){
if(StoreFieldEnum.BUSINESS_TIME_STRING.getValue().equals(changeField)){
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
//营业时间
String [] newValues = newValue.split("-");
String openTime = newValues[0];
String closeTime = newValues[1];
Date date1 = null;
Date date2 = null;
try {
date1 = sdf.parse(openTime);
} catch (ParseException e) {
e.printStackTrace();
}
try {
date2 = sdf.parse(closeTime);
} catch (ParseException e) {
e.printStackTrace();
}
store.setOpenTime(date1);
store.setCloseTime(date2);
}else if(StoreFieldEnum.CONACTS_PHONE.getValue().equals(changeField)){
//联系电话
store.setConactsPhone(newValue);
}else if(StoreFieldEnum.STORE_ADDRESS.getValue().equals(changeField)){
//门店地址
StoreAddressDTO obj = JSONObject.parseObject(newValue,StoreAddressDTO.class);
String areaId = obj.getAreaId();
String storeAddress = obj.getStoreAddress();
String arr[] = storeAddress.split(" ");
store.setAreaId(areaId);
store.setFullArea(arr[0]);
store.setStoreAddress(arr[1]);
}else if(StoreFieldEnum.STORE_AREA.getValue().equals(changeField)){
//门店面积
store.setStoreArea(Double.parseDouble(newValue));
}else if(StoreFieldEnum.STORE_NAME.getValue().equals(changeField)){
//门店名字
store.setStoreName(newValue);
}else if(StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){
//门店图片
}
}
}
......@@ -39,6 +39,7 @@ import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.StoreAddressDTO;
import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService;
......@@ -244,58 +245,10 @@ public class StoreController extends WebBaseController{
//要审核
int i = auditApiService.save(1, enterpriseId, staffId, storeId, changeField, oldValue, newValue);
}else{
//TODO 枚举变量的使用
if(!StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){
//非门店图片修改
getStoreDTO( store, changeField, oldValue, newValue);
storeService.saveOrUpdateStore(store);
}else{
//门店图片修改
List<StorePhotoDTO> oldStorePhoto = JSONObject.parseArray(oldValue, StorePhotoDTO.class);
List<StorePhotoDTO> newStorePhoto = JSONObject.parseArray(newValue, StorePhotoDTO.class);
List<String> delPhotos = new ArrayList<>();
// storeService.editStoreImage( storeId, newStorePhoto, delPhotos);
}
auditApiService.editStoreInfo(storeId, changeField, oldValue, newValue);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
void getStoreDTO(StoreDTO store,String changeField,String oldValue,String newValue){
if(StoreFieldEnum.BUSINESS_TIME_STRING.getValue().equals(changeField)){
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
//营业时间
String [] newValues = newValue.split("-");
String openTime = newValues[0];
String closeTime = newValues[1];
Date date1 = null;
Date date2 = null;
try {
date1 = sdf.parse(openTime);
} catch (ParseException e) {
e.printStackTrace();
}
try {
date2 = sdf.parse(closeTime);
} catch (ParseException e) {
e.printStackTrace();
}
store.setOpenTime(date1);
store.setCloseTime(date2);
}else if(StoreFieldEnum.CONACTS_PHONE.getValue().equals(changeField)){
//联系电话
store.setConactsPhone(newValue);
}else if(StoreFieldEnum.STORE_ADDRESS.getValue().equals(changeField)){
//门店地址
store.setConactsPhone(newValue);
}else if(StoreFieldEnum.STORE_AREA.getValue().equals(changeField)){
//门店面积
store.setConactsPhone(newValue);
}else if(StoreFieldEnum.STORE_NAME.getValue().equals(changeField)){
//门店名字
store.setConactsPhone(newValue);
}else if(StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){
//门店图片
}
}
//获取门店详情
@RequestMapping("/store-detail")
......
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