Commit 9c537e00 by qwmqiuwenmin

Merge branch 'developer' into 'master'

Developer

See merge request !19
parents 1346891d a2e879fc
...@@ -18,6 +18,8 @@ public class AuditDTO implements Serializable { ...@@ -18,6 +18,8 @@ public class AuditDTO implements Serializable {
private String commitStoreId; private String commitStoreId;
private String commitStoreName;
private String changeField; private String changeField;
private String oldValue; private String oldValue;
...@@ -40,9 +42,27 @@ public class AuditDTO implements Serializable { ...@@ -40,9 +42,27 @@ public class AuditDTO implements Serializable {
private Integer statusFlag; private Integer statusFlag;
private String detail;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getAuditId() { public String getCommitStoreName() {
return commitStoreName;
}
public void setCommitStoreName(String commitStoreName) {
this.commitStoreName = commitStoreName;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getAuditId() {
return auditId; return auditId;
} }
......
...@@ -27,9 +27,18 @@ public class QywxCallBackDTO implements Serializable{ ...@@ -27,9 +27,18 @@ public class QywxCallBackDTO implements Serializable{
private String departmentName; private String departmentName;
private Integer parentId; private Integer parentId;
private Integer order; private Integer order;
private String avatar;//头像
/**部门创建:create_party;部门修改:update_party;部门删除:delete_party* /**部门创建:create_party;部门修改:update_party;部门删除:delete_party*
* 成员创建:create_user;成员修改:update_user;成员删除:delete_user*/ * 成员创建:create_user;成员修改:update_user;成员删除:delete_user*/
private String changeType; private String changeType;
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getSuiteId() { public String getSuiteId() {
return suiteId; return suiteId;
...@@ -190,4 +199,7 @@ public class QywxCallBackDTO implements Serializable{ ...@@ -190,4 +199,7 @@ public class QywxCallBackDTO implements Serializable{
public void setStatus(Integer status) { public void setStatus(Integer status) {
this.status = status; this.status = status;
} }
} }
...@@ -59,13 +59,33 @@ public class WxEnterpriseDTO implements Serializable { ...@@ -59,13 +59,33 @@ public class WxEnterpriseDTO implements Serializable {
private String wxSecretKey; private String wxSecretKey;
private String memberSecret;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
//小程序版本
private String smallVersion;
public String getMemberSecret() {
return memberSecret;
}
public void setMemberSecret(String memberSecret) {
this.memberSecret = memberSecret;
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getWxEnterpriseId() { public String getSmallVersion() {
return smallVersion;
}
public void setSmallVersion(String smallVersion) {
this.smallVersion = smallVersion;
}
public String getWxEnterpriseId() {
return wxEnterpriseId; return wxEnterpriseId;
} }
......
...@@ -8,6 +8,6 @@ public interface ApplicationApiService { ...@@ -8,6 +8,6 @@ public interface ApplicationApiService {
List<ApplicationDTO> listApplication(); List<ApplicationDTO> listApplication();
List<ApplicationDTO> listByApplications(List<String> applicationIds);
} }
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.haoban.manage.api.dto.ApplicationSettingDTO; import com.gic.haoban.manage.api.dto.ApplicationSettingDTO;
/** /**
...@@ -11,4 +13,5 @@ public interface ApplicationSettingApiService { ...@@ -11,4 +13,5 @@ public interface ApplicationSettingApiService {
ApplicationSettingDTO findSettingByWxEnterpriseIdAndApplicationId(String wxEnterpriseId,String applicationId); ApplicationSettingDTO findSettingByWxEnterpriseIdAndApplicationId(String wxEnterpriseId,String applicationId);
List<ApplicationSettingDTO> listOpenByWxEnterpriseIdAndApplicationIds(String wxEnterpriseId,List<String> applicationIds);
} }
...@@ -12,11 +12,11 @@ import com.gic.haoban.manage.api.dto.AuditDTO; ...@@ -12,11 +12,11 @@ import com.gic.haoban.manage.api.dto.AuditDTO;
*/ */
public interface AuditApiService { public interface AuditApiService {
Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,String enterpriseId,Integer auditStatus,BasePageInfo pageInfo); Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,String enterpriseId,Integer auditStatus,Integer auditFlag,BasePageInfo pageInfo);
void audit(String auditId); void audit(String auditId,String aduitName);
void refuse(String auditId,String auditReason); void refuse(String auditId,String auditReason,String aduitName);
int save(Integer auditType,String wxEnterpriseId,String enterpriseId,String commitStaffId,String commitStoreId,String changeField,String oldValue,String newValue); int save(Integer auditType,String wxEnterpriseId,String enterpriseId,String commitStaffId,String commitStoreId,String changeField,String oldValue,String newValue);
......
...@@ -150,5 +150,13 @@ public interface DepartmentApiService { ...@@ -150,5 +150,13 @@ public interface DepartmentApiService {
* @param departmentId * @param departmentId
*/ */
ServiceResponse gicDel(String departmentId); ServiceResponse gicDel(String departmentId);
/**
* 查门店/部门列表
*
* @param
* @return
*/
ServiceResponse<List<DepartmentDTO>> listStoreListByStaffId(String wxUserId);
} }
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
* Created by tgs on 2020/2/9. * Created by tgs on 2020/2/9.
*/ */
public interface DictApiService { public interface DictApiService {
void saveDict(DictDTO dto); int saveDict(DictDTO dto);
DictDTO findOneDict(String dictId); DictDTO findOneDict(String dictId);
......
...@@ -58,4 +58,6 @@ public interface StaffApiService { ...@@ -58,4 +58,6 @@ public interface StaffApiService {
public int countByDepartmentIds(List<String> departmentIds); public int countByDepartmentIds(List<String> departmentIds);
public List<StaffDTO> listByPhoneNumber(String phoneNumber); public List<StaffDTO> listByPhoneNumber(String phoneNumber);
public List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
} }
...@@ -29,7 +29,13 @@ public class DictController extends WebBaseController{ ...@@ -29,7 +29,13 @@ public class DictController extends WebBaseController{
//保存字典 //保存字典
@RequestMapping("save-dict") @RequestMapping("save-dict")
public HaobanResponse saveDict(DictDTO dto) { public HaobanResponse saveDict(DictDTO dto) {
dictApiService.saveDict(dto); int i = dictApiService.saveDict(dto);
if(i == 8){
return resultResponse(HaoBanErrCode.ERR_10006);
}
if(i == 9){
return resultResponse(HaoBanErrCode.ERR_10007);
}
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//查看字典详情 //查看字典详情
......
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -11,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -11,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -56,13 +58,18 @@ public class EnterpriseController extends WebBaseController{ ...@@ -56,13 +58,18 @@ public class EnterpriseController extends WebBaseController{
//企业列表 //企业列表
@RequestMapping("wx-enterprise-list") @RequestMapping("wx-enterprise-list")
public HaobanResponse wxEnterpriseList(BasePageInfo pageInfo,String keyword,String gicEnterpriseName,Integer gicContactHelper,String version) { public HaobanResponse wxEnterpriseList(BasePageInfo pageInfo,String keyword,String gicEnterpriseName,Integer gicContactHelper,String version) {
List<EnterpriseDTO> enterpriseNames = enterpriseService.getEnterpriseByName(gicEnterpriseName);
List<String> wxEnterpriseIds = new ArrayList<String>(); List<String> wxEnterpriseIds = new ArrayList<String>();
if(CollectionUtil.isNotEmpty(enterpriseNames)){ if(!StringUtils.isEmpty(gicEnterpriseName)){
List<String>enterpriseIds = enterpriseNames.stream().map(s->s.getEnterpriseId()).collect(Collectors.toList()); List<EnterpriseDTO> enterpriseNames = enterpriseService.getEnterpriseByName(gicEnterpriseName);
List<EnterpriseDetailDTO> wxEnterpriseIdDTOs = wxEnterpriseRelatedApiService.listEnterpriseByEnterpriseIds(enterpriseIds); if(CollectionUtil.isNotEmpty(enterpriseNames)){
if(CollectionUtil.isNotEmpty(wxEnterpriseIdDTOs)){ List<String>enterpriseIds = enterpriseNames.stream().map(s->s.getEnterpriseId()).collect(Collectors.toList());
wxEnterpriseIds = wxEnterpriseIdDTOs.stream().map(s->s.getWxEnterpriseId()).collect(Collectors.toList()); List<EnterpriseDetailDTO> wxEnterpriseIdDTOs = wxEnterpriseRelatedApiService.listEnterpriseByEnterpriseIds(enterpriseIds);
if(CollectionUtil.isNotEmpty(wxEnterpriseIdDTOs)){
wxEnterpriseIds = wxEnterpriseIdDTOs.stream().map(s->s.getWxEnterpriseId()).collect(Collectors.toList());
}
}
if(CollectionUtil.isEmpty(wxEnterpriseIds)){
wxEnterpriseIds = Arrays.asList("-9999");
} }
} }
Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo,keyword,wxEnterpriseIds,gicContactHelper,version); Page<YwWxEnterpriseDTO> page = wxEnterpriseApiService.list(pageInfo,keyword,wxEnterpriseIds,gicContactHelper,version);
...@@ -97,7 +104,9 @@ public class EnterpriseController extends WebBaseController{ ...@@ -97,7 +104,9 @@ public class EnterpriseController extends WebBaseController{
List<DepartmentDTO> countList = departmentApiService.listByRelatedIds(storeIds); List<DepartmentDTO> countList = departmentApiService.listByRelatedIds(storeIds);
vo.setStoreCount(countList.size()); vo.setStoreCount(countList.size());
} }
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(vo.getEnterpriseId());
vo.setEnterpriseName(enterpriseDTO.getEnterpriseName());
vo.setEnterpriseLogo(enterpriseDTO.getQcloudImageUrl());
} }
return resultResponse(HaoBanErrCode.ERR_1,result); return resultResponse(HaoBanErrCode.ERR_1,result);
} }
......
...@@ -67,6 +67,8 @@ public enum HaoBanErrCode { ...@@ -67,6 +67,8 @@ public enum HaoBanErrCode {
ERR_10004(10004,"成员名称不能为空"), ERR_10004(10004,"成员名称不能为空"),
ERR_10005(10005,"成员已存在"), ERR_10005(10005,"成员已存在"),
ERR_10006(10006,"字典key已存在"),
ERR_10007(10007,"字典名称已存在"),
ERR_DEFINE(-888, "自定义错误"), ERR_DEFINE(-888, "自定义错误"),
......
...@@ -14,7 +14,15 @@ public class EnterpriseDetailVo implements Serializable { ...@@ -14,7 +14,15 @@ public class EnterpriseDetailVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String enterpriseId; private String enterpriseId;
private String enterpriseName; private String enterpriseName;
private String EnterpriseLogo;
private Integer storeCount = 0; private Integer storeCount = 0;
public String getEnterpriseLogo() {
return EnterpriseLogo;
}
public void setEnterpriseLogo(String enterpriseLogo) {
EnterpriseLogo = enterpriseLogo;
}
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
} }
......
...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanApplication; import com.gic.haoban.manage.service.entity.TabHaobanApplication;
public interface ApplicationMapper { public interface ApplicationMapper {
...@@ -18,4 +20,7 @@ public interface ApplicationMapper { ...@@ -18,4 +20,7 @@ public interface ApplicationMapper {
int updateByPrimaryKey(TabHaobanApplication record); int updateByPrimaryKey(TabHaobanApplication record);
List<TabHaobanApplication> listApplication(); List<TabHaobanApplication> listApplication();
List<TabHaobanApplication> listByApplicationIds(@Param("applicationIds")List<String> applicationIds);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanApplicationSetting; import com.gic.haoban.manage.service.entity.TabHaobanApplicationSetting;
...@@ -20,4 +22,6 @@ public interface ApplicationSettingMapper { ...@@ -20,4 +22,6 @@ public interface ApplicationSettingMapper {
void saveSetting(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("applicationId")String applicationId,@Param("openFlag")int openFlag); void saveSetting(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("applicationId")String applicationId,@Param("openFlag")int openFlag);
TabHaobanApplicationSetting findSetting(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("applicationId")String applicationId); TabHaobanApplicationSetting findSetting(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("applicationId")String applicationId);
List<TabHaobanApplicationSetting> listOpenByWxEnterpriseIdAndApplicationIds(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("applicationIds")List<String> applicationIds);
} }
\ No newline at end of file
...@@ -60,4 +60,6 @@ public interface DepartmentMapper { ...@@ -60,4 +60,6 @@ public interface DepartmentMapper {
int countByDepartment(@Param("departmentId")String departmentId); int countByDepartment(@Param("departmentId")String departmentId);
TabHaobanDepartment getByRelatedIdNotInRecycle(@Param("relatedId")String relatedId); TabHaobanDepartment getByRelatedIdNotInRecycle(@Param("relatedId")String relatedId);
List<TabHaobanDepartment> listByIds(@Param("departmentIds")List<String> departmentIds);
} }
\ No newline at end of file
...@@ -23,4 +23,8 @@ public interface DictMapper { ...@@ -23,4 +23,8 @@ public interface DictMapper {
List<TabHaobanDict> queryList(@Param("keys") List<String> keys); List<TabHaobanDict> queryList(@Param("keys") List<String> keys);
TabHaobanDict selectByDictKey(String dictKey);
TabHaobanDict selectByDictName(String dictKey);
} }
\ No newline at end of file
...@@ -34,4 +34,6 @@ public interface StaffMapper { ...@@ -34,4 +34,6 @@ public interface StaffMapper {
TabHaobanStaff selectSuperByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId); TabHaobanStaff selectSuperByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
List<TabHaobanStaff> listByPhoneNumber(@Param("phoneNumber")String phoneNumber); List<TabHaobanStaff> listByPhoneNumber(@Param("phoneNumber")String phoneNumber);
List<TabHaobanStaff> listByUserIdsAndWxEnterpriseId(@Param("userIds")List<String> userIds, @Param("wxEnterpriseId")String wxEnterpriseId);
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanAudit; import com.gic.haoban.manage.service.entity.TabHaobanAudit;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
...@@ -18,9 +20,12 @@ public interface TabHaobanAuditMapper { ...@@ -18,9 +20,12 @@ public interface TabHaobanAuditMapper {
int updateByPrimaryKey(TabHaobanAudit record); int updateByPrimaryKey(TabHaobanAudit record);
Page<TabHaobanAudit> page(Integer auditType, List<String> storeIds,List<String>staffIds,String wxEnterpriseId, String enterpriseId,Integer auditStatus ); Page<TabHaobanAudit> page(@Param("auditType")Integer auditType, @Param("storeIds")List<String> storeIds,@Param("staffIds")List<String>staffIds,@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId")String enterpriseId,@Param("auditStatus")Integer auditStatus,@Param("auditFlag")Integer auditFlag );
Page<TabHaobanAudit> pageForStoreIdsAndstaffIds(@Param("auditType")Integer auditType, @Param("storeIds")List<String> storeIds,@Param("staffIds")List<String>staffIds,@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId")String enterpriseId,@Param("auditStatus")Integer auditStatus,@Param("auditFlag")Integer auditFlag );
List<TabHaobanAudit> listByStoreId(String storeId); List<TabHaobanAudit> listByStoreId(String storeId);
TabHaobanAudit findByStoreIdAndChangeField(String storeId,String changeField); TabHaobanAudit findByStoreIdAndChangeField(@Param("storeId")String storeId,@Param("changeField")String changeField);
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
public interface WxEnterpriseRelatedMapper { public interface WxEnterpriseRelatedMapper {
...@@ -23,6 +25,6 @@ public interface WxEnterpriseRelatedMapper { ...@@ -23,6 +25,6 @@ public interface WxEnterpriseRelatedMapper {
List<TabHaobanWxEnterpriseRelated> queryAllHasGicEnterpriseId(); List<TabHaobanWxEnterpriseRelated> queryAllHasGicEnterpriseId();
List<TabHaobanWxEnterpriseRelated> listEnterpriseByEnterpriseIds(List<String> enterpriseIds); List<TabHaobanWxEnterpriseRelated> listEnterpriseByEnterpriseIds(@Param("enterpriseIds")List<String> enterpriseIds);
} }
\ No newline at end of file
...@@ -58,12 +58,22 @@ public class TabHaobanWxEnterprise implements Serializable { ...@@ -58,12 +58,22 @@ public class TabHaobanWxEnterprise implements Serializable {
private String wxSecretKey; private String wxSecretKey;
private String memberSecret;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getMemberSecret() {
return memberSecret;
}
public void setMemberSecret(String memberSecret) {
this.memberSecret = memberSecret;
}
public String getWxEnterpriseId() { public String getWxEnterpriseId() {
return wxEnterpriseId; return wxEnterpriseId;
} }
......
...@@ -44,4 +44,6 @@ public interface DepartmentService { ...@@ -44,4 +44,6 @@ public interface DepartmentService {
DepartmentDTO getByRelatedIdNotInRecycle(String relatedId); DepartmentDTO getByRelatedIdNotInRecycle(String relatedId);
List<DepartmentDTO> listByIds(List<String> departmentIds);
} }
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import java.util.List;
import java.util.Set; import java.util.Set;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
public interface StaffService { public interface StaffService {
...@@ -22,4 +23,6 @@ public interface StaffService { ...@@ -22,4 +23,6 @@ public interface StaffService {
TabHaobanStaff selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId); TabHaobanStaff selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId);
List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
} }
...@@ -164,4 +164,9 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -164,4 +164,9 @@ public class DepartmentServiceImpl implements DepartmentService {
return EntityUtil.changeEntityByJSON(DepartmentDTO.class,mapper.getByRelatedIdNotInRecycle(relatedId)); return EntityUtil.changeEntityByJSON(DepartmentDTO.class,mapper.getByRelatedIdNotInRecycle(relatedId));
} }
@Override
public List<DepartmentDTO> listByIds(List<String> departmentIds) {
return EntityUtil.changeEntityListByJSON(DepartmentDTO.class, mapper.listByIds(departmentIds));
}
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
...@@ -71,4 +74,9 @@ public class StaffServiceImpl implements StaffService { ...@@ -71,4 +74,9 @@ public class StaffServiceImpl implements StaffService {
return this.mapper.updateByPrimaryKeySelective(staff); return this.mapper.updateByPrimaryKeySelective(staff);
} }
@Override
public List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId) {
return EntityUtil.changeEntityListByJSON(StaffDTO.class, this.mapper.listByUserIdsAndWxEnterpriseId(userIds,wxEnterpriseId));
}
} }
...@@ -4,11 +4,15 @@ import java.util.List; ...@@ -4,11 +4,15 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.ApplicationDTO; import com.gic.haoban.manage.api.dto.ApplicationDTO;
import com.gic.haoban.manage.api.service.ApplicationApiService; import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.service.dao.mapper.ApplicationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanApplication; import com.gic.haoban.manage.service.entity.TabHaobanApplication;
import com.gic.haoban.manage.service.service.ApplicationService; import com.gic.haoban.manage.service.service.ApplicationService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
...@@ -16,11 +20,22 @@ public class ApplicationApiServiceImpl implements ApplicationApiService { ...@@ -16,11 +20,22 @@ public class ApplicationApiServiceImpl implements ApplicationApiService {
@Autowired @Autowired
private ApplicationService applicationService; private ApplicationService applicationService;
@Autowired
private ApplicationMapper applicationMapper;
@Override @Override
public List<ApplicationDTO> listApplication() { public List<ApplicationDTO> listApplication() {
List<TabHaobanApplication> list = applicationService.listApplication(); List<TabHaobanApplication> list = applicationService.listApplication();
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list); return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
} }
@Override
public List<ApplicationDTO> listByApplications(List<String> applicationIds) {
List<TabHaobanApplication> list = applicationMapper.listByApplicationIds(applicationIds);
if(CollectionUtil.isEmpty(list)){
return null;
}
List<ApplicationDTO> result = EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
return result;
}
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.ApplicationSettingDTO; import com.gic.haoban.manage.api.dto.ApplicationSettingDTO;
...@@ -48,4 +51,15 @@ public class ApplicationSettingApiServiceImpl implements ApplicationSettingApiSe ...@@ -48,4 +51,15 @@ public class ApplicationSettingApiServiceImpl implements ApplicationSettingApiSe
ApplicationSettingDTO dto = EntityUtil.changeEntity(ApplicationSettingDTO.class, tab); ApplicationSettingDTO dto = EntityUtil.changeEntity(ApplicationSettingDTO.class, tab);
return dto; return dto;
} }
@Override
public List<ApplicationSettingDTO> listOpenByWxEnterpriseIdAndApplicationIds(
String wxEnterpriseId, List<String> applicationIds) {
List<TabHaobanApplicationSetting> list = applicationSettingMapper.listOpenByWxEnterpriseIdAndApplicationIds(wxEnterpriseId,applicationIds);
if(CollectionUtil.isEmpty(list)){
return null;
}
List<ApplicationSettingDTO> result = EntityUtil.changeEntityListByJSON(ApplicationSettingDTO.class, list);
return result;
}
} }
...@@ -3,8 +3,10 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -3,8 +3,10 @@ package com.gic.haoban.manage.service.service.out.impl;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -20,6 +22,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -20,6 +22,7 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreDetailDTO;
import com.gic.enterprise.api.dto.StorePhotoDTO; import com.gic.enterprise.api.dto.StorePhotoDTO;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
...@@ -55,26 +58,46 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -55,26 +58,46 @@ public class AuditApiServiceImpl implements AuditApiService{
@Override @Override
public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId, public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,
String enterpriseId,Integer auditStatus, BasePageInfo pageInfo) { String enterpriseId,Integer auditStatus,Integer auditFlag, BasePageInfo pageInfo) {
List<String> storeIds = new ArrayList<>(); List<String> storeIds = new ArrayList<>();
List<String> staffIds = new ArrayList<>(); List<String> staffIds = new ArrayList<>();
if(StringUtils.isNotEmpty(search)){ if(StringUtils.isNotEmpty(search)){
List<TabHaobanDepartment> storeList = departmentMapper.listStoreLikeName(search); List<TabHaobanDepartment> storeList = departmentMapper.listStoreLikeName(search);
if(CollectionUtil.isNotEmpty(storeList)){ if(CollectionUtil.isNotEmpty(storeList)){
storeIds = storeList.stream().map(s->s.getRelatedId()).collect(Collectors.toList()); storeIds = storeList.stream().map(s->s.getRelatedId()).collect(Collectors.toList());
}else{
storeIds = Arrays.asList("-999");
} }
List<TabHaobanStaff> staffList = staffMapper.listLikeName(search); List<TabHaobanStaff> staffList = staffMapper.listLikeName(search);
if(CollectionUtil.isNotEmpty(staffList)){ if(CollectionUtil.isNotEmpty(staffList)){
staffIds = staffList.stream().map(s->s.getStaffId()).collect(Collectors.toList()); staffIds = staffList.stream().map(s->s.getStaffId()).collect(Collectors.toList());
}else{
staffIds = Arrays.asList("-999");
} }
} }
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize()); PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
com.github.pagehelper.Page<TabHaobanAudit> page = auditMapper.page(auditType, storeIds, staffIds, wxEnterpriseId,enterpriseId,auditStatus); com.github.pagehelper.Page<TabHaobanAudit> page = new com.github.pagehelper.Page<TabHaobanAudit>();
if(CollectionUtil.isNotEmpty(storeIds)&&CollectionUtil.isNotEmpty(staffIds)){
page = auditMapper.pageForStoreIdsAndstaffIds(auditType, storeIds, staffIds, wxEnterpriseId,enterpriseId,auditStatus,auditFlag);
}else{
page = auditMapper.page(auditType, storeIds, staffIds, wxEnterpriseId,enterpriseId,auditStatus,auditFlag);
}
// List<TabHaobanAudit> list = page.getResult();
if(CollectionUtil.isNotEmpty( page.getResult())){
List<String> commitStaffIds = page.getResult().stream().map(s->s.getCommitStaffId()).collect(Collectors.toList());
List<TabHaobanStaff> staffList = staffMapper.listByIds(commitStaffIds);
Map<String,TabHaobanStaff> map = com.gic.commons.util.CollectionUtil.toMap(staffList, "staffId");
for(TabHaobanAudit tab: page.getResult()){
String commitStaffId = tab.getCommitStaffId();
map.get(commitStaffId).getStaffName();
tab.setCommitStaffName(map.get(commitStaffId)==null?"":map.get(commitStaffId).getStaffName());
}
}
return PageUtil.changePageHelperToCurrentPage( page,AuditDTO.class); return PageUtil.changePageHelperToCurrentPage( page,AuditDTO.class);
} }
@Transactional @Transactional
@Override @Override
public void audit(String auditId) { public void audit(String auditId,String auditName) {
TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId); TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId);
if(tab==null){ if(tab==null){
return; return;
...@@ -82,6 +105,7 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -82,6 +105,7 @@ public class AuditApiServiceImpl implements AuditApiService{
tab.setAuditId(auditId); tab.setAuditId(auditId);
tab.setAuditStatus(1); tab.setAuditStatus(1);
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tab.setAuditName(auditName);
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
String storeId = tab.getCommitStoreId(); String storeId = tab.getCommitStoreId();
String oldValue = tab.getOldValue(); String oldValue = tab.getOldValue();
...@@ -90,12 +114,13 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -90,12 +114,13 @@ public class AuditApiServiceImpl implements AuditApiService{
this.editStoreInfo(storeId, changeField, oldValue, newValue); this.editStoreInfo(storeId, changeField, oldValue, newValue);
} }
@Override @Override
public void refuse(String auditId, String auditReason) { public void refuse(String auditId, String auditReason,String auditName) {
TabHaobanAudit tab = new TabHaobanAudit(); TabHaobanAudit tab = new TabHaobanAudit();
tab.setAuditId(auditId); tab.setAuditId(auditId);
tab.setAuditStatus(0); tab.setAuditStatus(2);
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tab.setAuditReason(auditReason); tab.setAuditReason(auditReason);
tab.setAuditName(auditName);
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
} }
@Override @Override
...@@ -134,15 +159,22 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -134,15 +159,22 @@ public class AuditApiServiceImpl implements AuditApiService{
if(!StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){ if(!StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){
//非门店图片修改 //非门店图片修改
logger.info("===================进222"); logger.info("===================进222");
getStoreDTO( store, changeField, oldValue, newValue); StoreDetailDTO detailDTO = new StoreDetailDTO();
storeService.saveOrUpdateStore(store); detailDTO.setStoreId(storeId);
detailDTO.setEnterpriseId(store.getEnterpriseId());
detailDTO.setStatus(2);
getStoreDTO( detailDTO, changeField, oldValue, newValue);
logger.info("detailDTO====================>为{}",JSONObject.toJSONString(detailDTO));
storeService.saveStore(detailDTO);
// storeService.saveOrUpdateStore(store);
}else{ }else{
//门店图片修改 //门店图片修改
logger.info("===================进333"); logger.info("===================进333");
storeService.updateStorePhotos(storeId, newValue); storeService.updateStorePhotos(storeId, newValue);
} }
} }
void getStoreDTO(StoreDTO store,String changeField,String oldValue,String newValue){ void getStoreDTO(StoreDetailDTO store,String changeField,String oldValue,String newValue){
logger.info("==========================>changeField={}",changeField); logger.info("==========================>changeField={}",changeField);
if(StoreFieldEnum.BUSINESS_TIME_STRING.getValue().equals(changeField)){ if(StoreFieldEnum.BUSINESS_TIME_STRING.getValue().equals(changeField)){
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
...@@ -150,20 +182,20 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -150,20 +182,20 @@ public class AuditApiServiceImpl implements AuditApiService{
String [] newValues = newValue.split("-"); String [] newValues = newValue.split("-");
String openTime = newValues[0]; String openTime = newValues[0];
String closeTime = newValues[1]; String closeTime = newValues[1];
Date date1 = null; // Date date1 = null;
Date date2 = null; // Date date2 = null;
try { // try {
date1 = sdf.parse(openTime); // date1 = sdf.parse(openTime);
} catch (ParseException e) { // } catch (ParseException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
try { // try {
date2 = sdf.parse(closeTime); // date2 = sdf.parse(closeTime);
} catch (ParseException e) { // } catch (ParseException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
store.setOpenTime(date1); store.setOpenTime(openTime);
store.setCloseTime(date2); store.setCloseTime(closeTime);
}else if(StoreFieldEnum.CONACTS_PHONE.getValue().equals(changeField)){ }else if(StoreFieldEnum.CONACTS_PHONE.getValue().equals(changeField)){
//联系电话 //联系电话
store.setConactsPhone(newValue); store.setConactsPhone(newValue);
...@@ -177,13 +209,17 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -177,13 +209,17 @@ public class AuditApiServiceImpl implements AuditApiService{
String arr[] = storeAddress.split(" "); String arr[] = storeAddress.split(" ");
store.setAreaId(areaId); store.setAreaId(areaId);
store.setFullArea(arr[0]); store.setFullArea(arr[0]);
store.setStoreAddress(arr[1]); //避免多个空格造成数据混乱
store.setStoreAddress(storeAddress.substring(storeAddress.indexOf(arr[0])+arr[0].length()+1));
}else if(StoreFieldEnum.STORE_AREA.getValue().equals(changeField)){ }else if(StoreFieldEnum.STORE_AREA.getValue().equals(changeField)){
//门店面积 //门店面积
store.setStoreArea(Double.parseDouble(newValue)); store.setStoreArea(Double.parseDouble(newValue));
}else if(StoreFieldEnum.STORE_NAME.getValue().equals(changeField)){ }else if(StoreFieldEnum.STORE_NAME.getValue().equals(changeField)){
//门店名字 //门店名字
store.setStoreName(newValue); store.setStoreName(newValue);
TabHaobanDepartment tab = departmentMapper.getByRelatedId(store.getStoreId());
tab.setDepartmentName(newValue);
departmentMapper.updateByPrimaryKey(tab);
}else if(StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){ }else if(StoreFieldEnum.STORE_IMAG.getValue().equals(changeField)){
//门店图片 //门店图片
} }
......
...@@ -32,6 +32,10 @@ public class AuditSettingApiServiceImpl implements AuditSettingApiService{ ...@@ -32,6 +32,10 @@ public class AuditSettingApiServiceImpl implements AuditSettingApiService{
tab.setStatusFlag(1); tab.setStatusFlag(1);
tab.setWxEnterpriseId(wxEnterpriseId); tab.setWxEnterpriseId(wxEnterpriseId);
auditSettingMapper.insert(tab); auditSettingMapper.insert(tab);
}else{
tab.setAuditFlag(auditFlag);
tab.setUpdateTime(new Date());
auditSettingMapper.updateByPrimaryKeySelective(tab);
} }
} }
......
...@@ -4,13 +4,16 @@ import java.util.ArrayList; ...@@ -4,13 +4,16 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.gic.haoban.base.api.common.Constant; import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -70,6 +73,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -70,6 +73,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
private StoreGroupService storeGroupService; private StoreGroupService storeGroupService;
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@Override @Override
...@@ -661,4 +667,18 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -661,4 +667,18 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override
public ServiceResponse<List<DepartmentDTO>> listStoreListByStaffId(String staffId) {
ServiceResponse<List<DepartmentDTO>> rer = new ServiceResponse<List<DepartmentDTO>>();
List<StaffDepartmentRelatedDTO> relateList = staffDepartmentRelatedApiService.listByStaffId(staffId);
if (CollectionUtils.isEmpty(relateList)) {
logger.info("没有部分显示:{}", staffId);
return rer;
}
List<String> departmentIds = relateList.stream().map(dto -> dto.getDepartmentId()).collect(Collectors.toList());
List<DepartmentDTO> departmentList = listByDepartmentIds(departmentIds, 1);
rer.setResult(departmentList);
return rer;
}
} }
...@@ -26,16 +26,25 @@ public class DictApiServiceImpl implements DictApiService{ ...@@ -26,16 +26,25 @@ public class DictApiServiceImpl implements DictApiService{
@Autowired @Autowired
private DictMapper dictMapper; private DictMapper dictMapper;
@Override @Override
public void saveDict(DictDTO dto) { public int saveDict(DictDTO dto) {
if(StringUtils.isBlank(dto.getDictId())){ if(StringUtils.isBlank(dto.getDictId())){
//空,则新增 //空,则新增
dto.setDictId(UuidUtil.randomUUID()); dto.setDictId(UuidUtil.randomUUID());
TabHaobanDict tab = EntityUtil.changeEntity(TabHaobanDict.class, dto); TabHaobanDict tab = EntityUtil.changeEntity(TabHaobanDict.class, dto);
dictMapper.insert(tab); TabHaobanDict tab1 = dictMapper.selectByDictKey(dto.getDictKey());
if(tab1!=null){
return 8;
}
TabHaobanDict tab2 = dictMapper.selectByDictName(dto.getDictName());
if(tab2!=null){
return 9;
}
dictMapper.insert(tab);
}else{ }else{
TabHaobanDict tab = EntityUtil.changeEntity(TabHaobanDict.class, dto); TabHaobanDict tab = EntityUtil.changeEntity(TabHaobanDict.class, dto);
dictMapper.updateByPrimaryKeySelective(tab); dictMapper.updateByPrimaryKeySelective(tab);
} }
return 1;
} }
@Override @Override
......
...@@ -95,8 +95,20 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -95,8 +95,20 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("【部门同步】dto={}",JSON.toJSONString(dto)); log.info("【部门同步】dto={}",JSON.toJSONString(dto));
DepartmentDTO parentDepartment = this.getParentDepartment(dto.getParentChain(), dto.getType(), enterprise.getWxEnterpriseId()); DepartmentDTO parentDepartment = this.getParentDepartment(dto.getParentChain(), dto.getType(), enterprise.getWxEnterpriseId());
if(parentDepartment == null && (dto.getChangeType() == GicEditType.ADD.getCode() || dto.getChangeType() == GicEditType.UPDATE.getCode())){ if(parentDepartment == null && (dto.getChangeType() == GicEditType.ADD.getCode() || dto.getChangeType() == GicEditType.UPDATE.getCode())){
log.info("【部门同步】父部门为空"); if(dto.getChangeType() == GicEditType.UPDATE.getCode()){
return; String departmentId = dto.getId();
DepartmentDTO exsit = departmentApiService.selectByRelatedId(departmentId);
if(exsit == null){
log.info("【部门同步】父部门为空");
return;
}else{
parentDepartment = departmentApiService.selectById(exsit.getParentDepartmentId());
}
}
if(parentDepartment == null){
log.info("【部门同步】父部门为空");
return;
}
} }
if(parentDepartment != null){ if(parentDepartment != null){
departmentDTO.setParentDepartmentId(parentDepartment.getDepartmentId()); departmentDTO.setParentDepartmentId(parentDepartment.getDepartmentId());
...@@ -193,6 +205,7 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -193,6 +205,7 @@ public class MessageApiServiceImpl implements MessageApiService {
String response = this.departmentService.add(departmentDTO); String response = this.departmentService.add(departmentDTO);
log.info("微信同步新增部门:{}", JSON.toJSONString(response)); log.info("微信同步新增部门:{}", JSON.toJSONString(response));
}else { }else {
departmentDTO.setIsStore(department.getIsStore());
departmentDTO.setDepartmentId(department.getDepartmentId()); departmentDTO.setDepartmentId(department.getDepartmentId());
this.departmentService.edit(departmentDTO); this.departmentService.edit(departmentDTO);
log.info("企业微信更新同步完成"); log.info("企业微信更新同步完成");
...@@ -224,6 +237,7 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -224,6 +237,7 @@ public class MessageApiServiceImpl implements MessageApiService {
staff.setStaffName(qywxCallBackDTO.getUserName()); staff.setStaffName(qywxCallBackDTO.getUserName());
staff.setWxUserId(qywxCallBackDTO.getUserid()); staff.setWxUserId(qywxCallBackDTO.getUserid());
staff.setPostion(qywxCallBackDTO.getPosition()); staff.setPostion(qywxCallBackDTO.getPosition());
staff.setHeadImg(qywxCallBackDTO.getAvatar());
staff.setNationCode("86"); staff.setNationCode("86");
//激活状态 //激活状态
if(qywxCallBackDTO.getStatus() != null && qywxCallBackDTO.getStatus() == 1){ if(qywxCallBackDTO.getStatus() != null && qywxCallBackDTO.getStatus() == 1){
......
...@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.hibernate.hql.internal.CollectionSubqueryFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -447,10 +448,15 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -447,10 +448,15 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,related.getClerkCode()); ClerkDTO clerkDTO= clerkService.getClerkByCodeNoStatus(enterpriseId,related.getClerkCode());
//if(!staffDTO.getPhoneNumber().equals(related.getPhoneNumber())||!staffDTO.getStaffName().equals(clerkDTO.getStaffName())){ //if(!staffDTO.getPhoneNumber().equals(related.getPhoneNumber())||!staffDTO.getStaffName().equals(clerkDTO.getStaffName())){
if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staffName) || !staffDTO.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))){ String headPic = staffDTO.getHeadImg();
if(clerkDTO != null && (!clerkDTO.getClerkName().equals(staffName) || !staffDTO.getPhoneNumber().equals(clerkDTO.getPhoneNumber()))
|| (org.apache.commons.lang3.StringUtils.isNotBlank(headPic) && !headPic.equals(clerkDTO.getImageUrl()))
|| !staffDTO.getSex().equals(clerkDTO.getClerkGender())){
logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO)); logger.info("【员工修改】clerkDTO={}",JSON.toJSONString(clerkDTO));
clerkDTO.setClerkName(staffDTO.getStaffName()); clerkDTO.setClerkName(staffDTO.getStaffName());
clerkDTO.setPhoneNumber(staffDTO.getPhoneNumber()); clerkDTO.setPhoneNumber(staffDTO.getPhoneNumber());
clerkDTO.setHeadImgUrl(staffDTO.getHeadImg());
clerkDTO.setClerkGender(staffDTO.getSex().toString());
clerkService.updateClerk(clerkDTO); clerkService.updateClerk(clerkDTO);
} }
//} //}
...@@ -637,7 +643,10 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -637,7 +643,10 @@ public class StaffApiServiceImpl implements StaffApiService {
String nationcode = clerkDTO.getNationcode(); String nationcode = clerkDTO.getNationcode();
Integer sex = clerkDTO.getClerkGender(); Integer sex = clerkDTO.getClerkGender();
String headPic = clerkDTO.getHeadImgUrl(); String headPic = clerkDTO.getHeadImgUrl();
Integer status = 1; Integer status = clerkDTO.getStatus();
if(status == null){
status = 1;
}
String postion = clerkDTO.getPostionName(); String postion = clerkDTO.getPostionName();
String enterpriseId = clerkDTO.getEnterpriseId(); String enterpriseId = clerkDTO.getEnterpriseId();
...@@ -691,10 +700,12 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -691,10 +700,12 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
}else{ }else{
String staffId = staff.getStaffId(); String staffId = staff.getStaffId();
logger.info("【员工修改】staff={},status={}",JSON.toJSONString(staff),status);
//删除 //删除
if(status == 0){ if(status == 0){
StaffDepartmentRelatedDTO staffRelated = this.getDepartmentIdAndStaffId(departmentId, staffId); StaffDepartmentRelatedDTO staffRelated = this.getDepartmentIdAndStaffId(departmentId, staffId);
if(staffRelated != null){ if(staffRelated != null){
staffRelated.setUpdateTime(new Date());
staffRelated.setClerkCode(null); staffRelated.setClerkCode(null);
staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, staffRelated)); staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, staffRelated));
} }
...@@ -724,11 +735,13 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -724,11 +735,13 @@ public class StaffApiServiceImpl implements StaffApiService {
StaffDepartmentRelatedDTO isCodeExist = this.getDepartmentIdAndCode(departmentId,code); StaffDepartmentRelatedDTO isCodeExist = this.getDepartmentIdAndCode(departmentId,code);
//如果这个人已经绑定了 先解绑 //如果这个人已经绑定了 先解绑
if(isCodeExist != null){ if(isCodeExist != null){
staffRelated.setUpdateTime(new Date());
isCodeExist.setClerkCode(null); isCodeExist.setClerkCode(null);
staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, isCodeExist)); staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, isCodeExist));
} }
//如果这个人是未绑定的 则绑定clerk //如果这个人是未绑定的 则绑定clerk
if(staffRelated != null){ if(staffRelated != null){
staffRelated.setUpdateTime(new Date());
staffRelated.setClerkCode(code); staffRelated.setClerkCode(code);
staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, staffRelated)); staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, staffRelated));
} }
...@@ -792,6 +805,23 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -792,6 +805,23 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
return staffDepartmentRelatedMapper.countByDepartmentIds(departmentIds); return staffDepartmentRelatedMapper.countByDepartmentIds(departmentIds);
} }
@Override
public List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId) {
List<StaffDTO> list = staffService.listByUserIdsAndWxEnterpriseId(userIds,wxEnterpriseId);
if(list == null){
return Collections.EMPTY_LIST;
}
for (StaffDTO staffDTO : list) {
List<String> departmentIds = new ArrayList<>();
List<TabHaobanStaffDepartmentRelated> relatedList = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffDTO.getStaffId());
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : relatedList) {
departmentIds.add(tabHaobanStaffDepartmentRelated.getDepartmentId());
}
List<DepartmentDTO> departmentList = departmentService.listByIds(departmentIds);
staffDTO.setDepartmentList(departmentList);
}
return list;
}
// private String getMobile(String phoneNumber,String nationcode){ // private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber; // String mobile = nationcode + phoneNumber;
......
...@@ -9,7 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,7 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.GicTreeDTO; import com.gic.enterprise.api.dto.GicTreeDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreGroupService; import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
...@@ -29,7 +31,6 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -29,7 +31,6 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper; private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper;
@Autowired @Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService; private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired @Autowired
private StoreGroupService storeGroupService; private StoreGroupService storeGroupService;
@Autowired @Autowired
......
package com.gic.haoban.manage.service.util;
import com.gic.commons.util.StringUtil;
public class EmojiFilterUtil {
/**
* @param isPharse 是否是短语 若是短语则 超过20字符编程*
*/
public static String filterEmojiLast(String content, boolean isPhrase) {
byte[] conbyte = content.getBytes();
for (int i = 0; i < conbyte.length; i++) {
if ((conbyte[i] & 0xF8) == 0xF0) {
for (int j = 0; j < 4; j++) {
conbyte[i + j] = 0x30;
}
i += 3;
}
}
content = new String(conbyte);
return filterEmoji(content.replaceAll("0000", ""), isPhrase);
}
private static String filterEmoji(String source, boolean isPhrase) {
if (!containsEmoji(source)) {
return source;// 如果不包含,直接返回
}
// 到这里铁定包含
StringBuilder buf = null;
int len = source.length();
if (len > 20 && isPhrase) {
return "*";
}
for (int i = 0; i < len; i++) {
char codePoint = source.charAt(i);
if (isEmojiCharacter(codePoint)) {
if (buf == null) {
buf = new StringBuilder(source.length());
}
buf.append(codePoint);
}
}
if (buf == null) {
return source;// 如果没有找到 emoji表情,则返回源字符串
} else {
if (buf.length() == len) {// 这里的意义在于尽可能少的toString,因为会重新生成字符串
buf = null;
return source;
} else {
return buf.toString();
}
}
}
private static boolean isEmojiCharacter(char codePoint) {
return (codePoint == 0x0) || (codePoint == 0x9) || (codePoint == 0xA) || (codePoint == 0xD)
|| ((codePoint >= 0x20) && (codePoint <= 0xD7FF)) || ((codePoint >= 0xE000) && (codePoint <= 0xFFFD))
|| ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF));
}
// 判断表情符
private static boolean containsEmoji(String source) {
if (StringUtil.isBlank(source)) {
return false;
}
source = source.replaceAll("[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]", "*");
int len = source.length();
for (int i = 0; i < len; i++) {
char codePoint = source.charAt(i);
if (isEmojiCharacter(codePoint)) {
// do nothing,判断到了这里表明,确认有表情字符
return true;
}
}
return false;
}
}
...@@ -49,5 +49,7 @@ ...@@ -49,5 +49,7 @@
<dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/>
<dubbo:reference interface="com.gic.member.api.service.MemberOpenCardBusinessService" id="memberOpenCardBusinessService"/>
</beans> </beans>
\ No newline at end of file
...@@ -145,4 +145,17 @@ ...@@ -145,4 +145,17 @@
from tab_haoban_application from tab_haoban_application
where status_flag = 1 where status_flag = 1
</select> </select>
<select id="listByApplicationIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_application
where status_flag = 1
<if test="applicationIds != null and applicationIds.size() > 0">
and application_id IN
<foreach collection="applicationIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -117,14 +117,10 @@ ...@@ -117,14 +117,10 @@
</update> </update>
<update id="saveSetting" parameterType="com.gic.haoban.manage.service.entity.TabHaobanApplicationSetting" > <update id="saveSetting" parameterType="com.gic.haoban.manage.service.entity.TabHaobanApplicationSetting" >
update tab_haoban_application_setting update tab_haoban_application_setting
<set > set update_time = NOW(),
<if test="openFlag != null" > <if test="openFlag != null" >
open_flag = #{openFlag,jdbcType=INTEGER}, open_flag = #{openFlag,jdbcType=INTEGER}
</if> </if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and application_id = #{applicationId,jdbcType=VARCHAR} and application_id = #{applicationId,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1
...@@ -138,4 +134,21 @@ ...@@ -138,4 +134,21 @@
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</select> </select>
<select id="listOpenByWxEnterpriseIdAndApplicationIds" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_application_setting
where
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and open_flag = 1
<if test="applicationIds != null and applicationIds.size() > 0">
and application_id IN
<foreach collection="applicationIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_department from tab_haoban_department
where department_name like contact('%',#{departmentName,jdbcType=VARCHAR},'%') where department_name like CONCAT('%',#{departmentName,jdbcType=VARCHAR},'%')
and status_flag = 1 and status_flag = 1
and is_store =1 and is_store =1
</select> </select>
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_department from tab_haoban_department
where status_flag = 1 where status_flag = 1
and is_store = #{storeFlag,jdbcType=INTEGER} and is_store = 1
<if test="relatedIds != null and relatedIds.size() > 0"> <if test="relatedIds != null and relatedIds.size() > 0">
and related_id IN and related_id IN
<foreach collection="relatedIds" item="id" index="index" open="(" close=")" separator=","> <foreach collection="relatedIds" item="id" index="index" open="(" close=")" separator=",">
...@@ -462,4 +462,18 @@ ...@@ -462,4 +462,18 @@
and status_flag = 1 and status_flag = 1
and recycle_flag != 1 and recycle_flag != 1
</select> </select>
<select id="listByIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
<if test="departmentIds != null and departmentIds.size() > 0">
and department_id IN
<foreach collection="departmentIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by sort desc
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</delete> </delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDict" > <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDict" >
insert into tab_haoban_dict (dict_id, dict_name, dict_key, insert into tab_haoban_dict (dict_id, dict_name, dict_key,
dict_title, dict_desc, dict_content,opt_user_name,opt_user_id,create_time,update_time dict_title, dict_desc, dict_content,opt_user_id,opt_user_name,create_time,update_time
) )
values (#{dictId,jdbcType=VARCHAR}, #{dictName,jdbcType=VARCHAR}, #{dictKey,jdbcType=VARCHAR}, values (#{dictId,jdbcType=VARCHAR}, #{dictName,jdbcType=VARCHAR}, #{dictKey,jdbcType=VARCHAR},
#{dictTitle,jdbcType=VARCHAR}, #{dictDesc,jdbcType=VARCHAR}, #{dictContent,jdbcType=VARCHAR} #{dictTitle,jdbcType=VARCHAR}, #{dictDesc,jdbcType=VARCHAR}, #{dictContent,jdbcType=VARCHAR}
...@@ -133,4 +133,19 @@ ...@@ -133,4 +133,19 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectByDictKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_dict
where dict_key = #{dictKey,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select id="selectByDictName" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_dict
where dict_name = #{dictName,jdbcType=VARCHAR}
and status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -180,6 +180,7 @@ ...@@ -180,6 +180,7 @@
where wx_user_id = #{wxUserId} where wx_user_id = #{wxUserId}
and status_flag = 1 and status_flag = 1
and unionid = #{unionid} and unionid = #{unionid}
limit 1
</select> </select>
<update id="deleteByUnionidAndUserId" parameterType="com.gic.haoban.manage.service.entity.MemberUnionidRelated" > <update id="deleteByUnionidAndUserId" parameterType="com.gic.haoban.manage.service.entity.MemberUnionidRelated" >
......
...@@ -297,7 +297,7 @@ ...@@ -297,7 +297,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_staff from tab_haoban_staff
where status_flag = 1 where status_flag = 1
and staff_name like contact('%',#{staffName,jdbcType=VARCHAR},'%') and staff_name like CONCAT('%',#{staffName,jdbcType=VARCHAR},'%')
</select> </select>
<select id="selectByUserIdAndEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByUserIdAndEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" >
...@@ -318,4 +318,18 @@ ...@@ -318,4 +318,18 @@
and super_manager_flag = 1 and super_manager_flag = 1
</select> </select>
<select id="listByUserIdsAndWxEnterpriseId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId}
<if test="userIds != null and userIds.size() > 0">
and wx_user_id IN
<foreach collection="userIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -280,22 +280,63 @@ ...@@ -280,22 +280,63 @@
<if test = "wxEnterpriseId != null"> <if test = "wxEnterpriseId != null">
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</if> </if>
<if test = "enterpriseId != null"> <if test = "enterpriseId != null and enterpriseId !=''">
and enterprise_id = #{enterpriseId,jdbcType=VARCHAR} and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
</if> </if>
<if test = "audit_type != null"> <if test = "auditType != null">
and audit_type = #{auditType,jdbcType=INTEGER} and audit_type = #{auditType,jdbcType=INTEGER}
</if> </if>
<if test = "audit_status != null and audit_status == 0"> <if test = "auditFlag != null and auditFlag == 0">
and audit_status = 0 and audit_status = 0
</if> </if>
<if test = "audit_status != null and audit_status != 0"> <if test = "auditFlag != null and auditFlag != 0">
and audit_status in (1,2) and audit_status in (1,2)
</if> </if>
<if test = "auditStatus != null">
and audit_status = #{auditStatus,jdbcType=INTEGER}
</if>
<include refid="storeSql"/> <include refid="storeSql"/>
<include refid="staffSql"/> <include refid="staffSql"/>
order by commit_time desc
</select>
<select id="pageForStoreIdsAndstaffIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_audit
where 1=1
<if test = "wxEnterpriseId != null">
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</if>
<if test = "enterpriseId != null and enterpriseId !=''">
and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
</if>
<if test = "auditType != null">
and audit_type = #{auditType,jdbcType=INTEGER}
</if>
<if test = "auditFlag != null and auditFlag == 0">
and audit_status = 0
</if>
<if test = "auditFlag != null and auditFlag != 0">
and audit_status in (1,2)
</if>
<if test = "auditStatus != null">
and audit_status = #{auditStatus,jdbcType=INTEGER}
</if>
and ( commit_store_id in
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
or commit_staff_id in
<foreach collection="staffIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
order by commit_time desc
</select> </select>
<select id="listByStoreId" resultMap="BaseResultMap" > <select id="listByStoreId" resultMap="BaseResultMap" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<result column="square_logo_url" property="squareLogoUrl" jdbcType="VARCHAR" /> <result column="square_logo_url" property="squareLogoUrl" jdbcType="VARCHAR" />
<result column="round_logo_url" property="roundLogoUrl" jdbcType="VARCHAR" /> <result column="round_logo_url" property="roundLogoUrl" jdbcType="VARCHAR" />
<result column="wx_secret_key" property="wxSecretKey" jdbcType="VARCHAR" /> <result column="wx_secret_key" property="wxSecretKey" jdbcType="VARCHAR" />
<result column="member_secret" property="memberSecret" jdbcType="VARCHAR"/>
<result column="level" property="level" jdbcType="INTEGER" /> <result column="level" property="level" jdbcType="INTEGER" />
<result column="contact_flag" property="contactFlag" jdbcType="INTEGER" /> <result column="contact_flag" property="contactFlag" jdbcType="INTEGER" />
<result column="bind_flag" property="bindFlag" jdbcType="INTEGER" /> <result column="bind_flag" property="bindFlag" jdbcType="INTEGER" />
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
corp_user_max, corp_full_name, subject_type, verified_end_time, corp_wxqrcode, corp_scale, corp_user_max, corp_full_name, subject_type, verified_end_time, corp_wxqrcode, corp_scale,
corp_industry, corp_sub_industry, location, auth_info, agent, agentid, appid, name, corp_industry, corp_sub_industry, location, auth_info, agent, agentid, appid, name,
square_logo_url, round_logo_url, level, bind_flag, status_flag, create_time, update_time,contact_flag,wx_secret_key square_logo_url, round_logo_url, level, bind_flag, status_flag, create_time, update_time,contact_flag,wx_secret_key
,member_secret
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
......
...@@ -68,6 +68,11 @@ ...@@ -68,6 +68,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-wechat-token-api</artifactId>
<version>${gic-wechat-token-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId> <artifactId>gic-commons</artifactId>
<version>${gic-commons}</version> <version>${gic-commons}</version>
<exclusions> <exclusions>
......
...@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; ...@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
...@@ -142,4 +143,17 @@ public class AuthRequestUtil { ...@@ -142,4 +143,17 @@ public class AuthRequestUtil {
.getRequestAttributes(); .getRequestAttributes();
return attrs.getResponse(); return attrs.getResponse();
} }
public static Object getLoginUser() {
Cookie[] cookies = AuthRequestUtil.getRequest().getCookies();
String token = "";
if(cookies != null){
for (Cookie cookie : cookies) {
if(cookie.getName().equals("token")){
token = cookie.getValue();
}
}
}
return getAppLoginUser(token);
}
} }
package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxApplicationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.AdminRoleVO;
import com.gic.haoban.manage.web.vo.AdminVO;
import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
@RestController
public class AdminController extends WebBaseController{
private static Logger logger = LoggerFactory.getLogger(AdminController.class);
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@Autowired
private WxApplicationApiService wxApplicationApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@RequestMapping("admin-list")
public HaobanResponse adminList() {
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 1);
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
logger.info("【管理员查询】corpid={},siteId={},agentId={}",enterprise.getCorpid(),application.getSiteId(),application.getAgentId());
String adminList = qywxSuiteApiService.getAdminList(enterprise.getCorpid(), application.getSiteId(), Integer.parseInt(application.getAgentId()));
logger.info("【管理员查询】userIds={}",JSON.toJSONString(adminList));
List<String> userIds = new ArrayList<String>();
if(StringUtils.isNotBlank(adminList)){
JSONArray jsonArr = JSON.parseArray(adminList);
for (Object object : jsonArr) {
JSONObject json = JSON.parseObject(JSON.toJSONString(object));
userIds.add(json.getString("userid"));
}
}
List<StaffDTO> list = new ArrayList<>();
List<AdminVO> resultList = new ArrayList<>();
if(!userIds.isEmpty()){
list = staffApiService.listByUserIdsAndWxEnterpriseId(userIds,wxEnterpriseId);
for (StaffDTO staffDTO : list) {
AdminVO vo = new AdminVO();
vo.setRoleId(staffDTO.getStaffId());
vo.setRoleName("管理员");
List<AdminRoleVO> roleList = new ArrayList<>();
List<DepartmentDTO> departmentList = staffDTO.getDepartmentList();
for (DepartmentDTO departmentDTO : departmentList) {
AdminRoleVO role = new AdminRoleVO();
role.setDepartmentName(departmentDTO.getDepartmentName());
role.setUserName(staffDTO.getStaffName());
role.setUserPhone(staffDTO.getPhoneNumber());
roleList.add(role);
}
vo.setRoleUser(roleList);
resultList.add(vo);
}
}
return resultResponse(HaoBanErrCode.ERR_1,resultList);
}
}
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig; import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
...@@ -55,6 +61,33 @@ public class ApplicationController extends WebBaseController{ ...@@ -55,6 +61,33 @@ public class ApplicationController extends WebBaseController{
List<ApplicationDTO> list = applicationApiService.listApplication(); List<ApplicationDTO> list = applicationApiService.listApplication();
return resultResponse(HaoBanErrCode.ERR_1,list); return resultResponse(HaoBanErrCode.ERR_1,list);
} }
@IgnoreLogin
@RequestMapping("application-open-close-list")
public HaobanResponse applicationList(String wxEnterpriseId) {
if(StringUtils.isAnyBlank(wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2);
}
Map<String,Object> map = new HashMap<>();
List<ApplicationDTO> list = applicationApiService.listApplication();
List<String> applicationIds = list.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
List<ApplicationSettingDTO> result = applicationSettingApiService.listOpenByWxEnterpriseIdAndApplicationIds(wxEnterpriseId,applicationIds);
//开启
List<ApplicationDTO> openList = new ArrayList<ApplicationDTO>();
List<String> openApplicationIds = new ArrayList<>();
if(CollectionUtil.isNotEmpty(result)){
openApplicationIds = result.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
openList = applicationApiService.listByApplications(openApplicationIds);
}
//关闭
List<ApplicationDTO> closeList = new ArrayList<ApplicationDTO>();
applicationIds.removeAll(openApplicationIds);
if(CollectionUtil.isNotEmpty(applicationIds)){
closeList = applicationApiService.listByApplications(applicationIds);
}
map.put("open", openList);
map.put("close", closeList);
return resultResponse(HaoBanErrCode.ERR_1,map);
}
@RequestMapping("open-or-close") @RequestMapping("open-or-close")
public HaobanResponse applicationList(String wxEnterpriseId, String applicationId, Integer openFlag) { public HaobanResponse applicationList(String wxEnterpriseId, String applicationId, Integer openFlag) {
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig; import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.GlobalVar; import com.gic.haoban.common.utils.GlobalVar;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.ApplicationSettingApiService; import com.gic.haoban.manage.api.service.ApplicationSettingApiService;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService; import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService; import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.anno.HttpLimit;
import com.gic.haoban.manage.web.anno.IgnoreLogin; import com.gic.haoban.manage.web.anno.IgnoreLogin;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.config.Config; import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.vo.LoginVO; import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.haoban.manage.web.vo.StaffVO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
...@@ -42,7 +53,13 @@ public class AuditController extends WebBaseController{ ...@@ -42,7 +53,13 @@ public class AuditController extends WebBaseController{
private AuditSettingApiService auditSettingApiService; private AuditSettingApiService auditSettingApiService;
@Autowired @Autowired
private AuditApiService auditApiService; private AuditApiService auditApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private StoreService storeService;
//设置保存 //设置保存
@HttpLimit
@RequestMapping("open-or-close") @RequestMapping("open-or-close")
public HaobanResponse openOrClose(String wxEnterpriseId,Integer auditFlag) { public HaobanResponse openOrClose(String wxEnterpriseId,Integer auditFlag) {
if(StringUtils.isAnyBlank(wxEnterpriseId)){ if(StringUtils.isAnyBlank(wxEnterpriseId)){
...@@ -60,34 +77,93 @@ public class AuditController extends WebBaseController{ ...@@ -60,34 +77,93 @@ public class AuditController extends WebBaseController{
if(StringUtils.isAnyBlank(wxEnterpriseId)){ if(StringUtils.isAnyBlank(wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId); AuditSettingDTO auditSettingDTO = auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1); if(auditSettingDTO == null){
auditSettingDTO = new AuditSettingDTO();
auditSettingDTO.setAuditFlag(1);
}
return resultResponse(HaoBanErrCode.ERR_1,auditSettingDTO);
} }
//分页查找 //分页查找
@RequestMapping("find-page") @RequestMapping("find-page")
public HaobanResponse findPage(String wxEnterpriseId,String enterpriseId,String search,BasePageInfo pageInfo ,Integer auditType,Integer auditStatus ) { public HaobanResponse findPage(String wxEnterpriseId,String enterpriseId,String search,BasePageInfo pageInfo ,Integer auditType,Integer auditStatus,Integer auditFlag ) {
if(auditStatus == null){ if(auditFlag == null){
return resultResponse(HaoBanErrCode.ERR_2);
}
if(StringUtils.isAnyBlank(wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
Page<AuditDTO> page = auditApiService.page(auditType, search, wxEnterpriseId,enterpriseId, auditStatus, pageInfo); Page<AuditDTO> page = auditApiService.page(auditType, search, wxEnterpriseId,enterpriseId, auditStatus,auditFlag, pageInfo);
List<AuditDTO> list = page.getResult();
List<String> storeIds = list.stream().map(s->s.getCommitStoreId()).collect(Collectors.toList());
String[] array=storeIds.toArray(new String[storeIds.size()]);
List<StoreDTO> stores = storeService.getStores(array);
Map<String,StoreDTO> map = com.gic.commons.util.CollectionUtil.toMap(stores, "storeId");
for(AuditDTO dto:list){
String t = dto.getChangeField();
String detail = "";
if(StoreFieldEnum.STORE_NAME.getValue().equals(t)){
detail = "将"+"门店名称"+"\""+dto.getOldValue()+"\""+"修改为"+"\""+dto.getNewValue()+"\"";
}else if(StoreFieldEnum.STORE_AREA.getValue().equals(t)){
detail = "将"+"门店面积"+"\""+dto.getOldValue()+"\""+"修改为"+"\""+dto.getNewValue()+"\"";
}else if(StoreFieldEnum.CONACTS_PHONE.getValue().equals(t)){
detail = "将"+"联系电话"+"\""+dto.getOldValue()+"\""+"修改为"+"\""+dto.getNewValue()+"\"";
}else if(StoreFieldEnum.BUSINESS_TIME_STRING.getValue().equals(t)){
detail = "将"+"营业时间"+"\""+dto.getOldValue()+"\""+"修改为"+"\""+dto.getNewValue()+"\"";
}else if(StoreFieldEnum.STORE_ADDRESS.getValue().equals(t)){
String oldValue = dto.getOldValue();
String newValue = dto.getNewValue();
JSONObject oldJSONObject = JSONObject.parseObject(oldValue);
String oldAddress = oldJSONObject.get("storeAddress").toString();
JSONObject newJSONObject = JSONObject.parseObject(newValue);
String newAddress = newJSONObject.get("storeAddress").toString();
detail = "将"+"门店地址"+"\""+oldAddress+"\""+"修改为"+"\""+newAddress+"\"";
}else if(StoreFieldEnum.STORE_IMAG.getValue().equals(t)){
detail = "门店图片变更";
}
dto.setDetail(detail);
String storeName = map.get(dto.getCommitStoreId())==null?"":map.get(dto.getCommitStoreId()).getStoreName();
dto.setCommitStoreName(storeName);
}
page.setResult(list);
return resultResponse(HaoBanErrCode.ERR_1,page); return resultResponse(HaoBanErrCode.ERR_1,page);
} }
//获取详情
@RequestMapping("get-staff-detail")
public HaobanResponse getStaffDetail(String staffId ) {
if(StringUtils.isAnyBlank(staffId)){
return resultResponse(HaoBanErrCode.ERR_2);
}
StaffDTO staffDTO = staffApiService.selectById(staffId);
// StaffVO staffVO = new StaffVO();
// staffVO.setPhoneNumber(phoneNumber);
// staffVO.setNationCode(nationCode);
// staffVO.setPostion(postion);
return resultResponse(HaoBanErrCode.ERR_1,staffDTO);
}
//审核拒绝 //审核拒绝
@HttpLimit
@RequestMapping("refuse") @RequestMapping("refuse")
public HaobanResponse refuse(String auditId,String auditReason ) { public HaobanResponse refuse(String auditId,String auditReason ,String auditName) {
if(StringUtils.isAnyBlank(auditId,auditReason)){ if(StringUtils.isAnyBlank(auditId,auditReason,auditName)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
auditApiService.refuse(auditId, auditReason); auditApiService.refuse(auditId, auditReason,auditName);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//审核同意 //审核同意
@HttpLimit
@RequestMapping("audit") @RequestMapping("audit")
public HaobanResponse audit(String auditId ) { public HaobanResponse audit(String auditId,String auditName ) {
if(StringUtils.isAnyBlank(auditId)){ if(StringUtils.isAnyBlank(auditId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
auditApiService.audit(auditId); auditApiService.audit(auditId,auditName);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
} }
...@@ -119,17 +119,7 @@ public class LoginController extends WebBaseController{ ...@@ -119,17 +119,7 @@ public class LoginController extends WebBaseController{
@RequestMapping("get-login-info") @RequestMapping("get-login-info")
public HaobanResponse getLoginInfo(){ public HaobanResponse getLoginInfo(){
Cookie[] cookies = AuthRequestUtil.getRequest().getCookies(); LoginVO loginVO = (LoginVO) AuthRequestUtil.getLoginUser();
String token = "";
if(cookies != null){
for (Cookie cookie : cookies) {
if(cookie.getName().equals("token")){
token = cookie.getValue();
}
}
}
LoginVO loginVO = (LoginVO) AuthRequestUtil.getAppLoginUser(token);
return resultResponse(HaoBanErrCode.ERR_1,loginVO); return resultResponse(HaoBanErrCode.ERR_1,loginVO);
} }
......
...@@ -3,6 +3,8 @@ package com.gic.haoban.manage.web.controller; ...@@ -3,6 +3,8 @@ package com.gic.haoban.manage.web.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.Cookie;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -52,7 +54,7 @@ public class StaffController extends WebBaseController{ ...@@ -52,7 +54,7 @@ public class StaffController extends WebBaseController{
@RequestMapping("staff-add") @RequestMapping("staff-add")
public HaobanResponse staffAdd(StaffDTO staffDTO,String departmentIds){ public HaobanResponse staffAdd(StaffDTO staffDTO,String departmentIds){
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser(); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
String staffName = staffDTO.getStaffName(); String staffName = staffDTO.getStaffName();
String phoneNumber = staffDTO.getPhoneNumber(); String phoneNumber = staffDTO.getPhoneNumber();
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collector; import java.util.stream.Collector;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -13,7 +16,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -13,7 +16,9 @@ import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.DateUtil;
import com.gic.enterprise.api.dto.EnterpriseAndUserDTO; import com.gic.enterprise.api.dto.EnterpriseAndUserDTO;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
...@@ -25,20 +30,28 @@ import com.gic.haoban.common.utils.EntityUtil; ...@@ -25,20 +30,28 @@ import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO;
import com.gic.haoban.manage.api.dto.WxApplicationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO; import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.anno.HttpLimit; import com.gic.haoban.manage.web.anno.HttpLimit;
import com.gic.haoban.manage.web.anno.IgnoreLogin; import com.gic.haoban.manage.web.anno.IgnoreLogin;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO; import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.haoban.manage.web.vo.StoreVo; import com.gic.haoban.manage.web.vo.StoreVo;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.token.api.dto.QywxCorpInfoDTO;
import com.gic.wechat.token.api.service.QywxTokenManageService;
@RestController @RestController
public class WxEnterpriseController extends WebBaseController{ public class WxEnterpriseController extends WebBaseController{
private static Logger logger = LoggerFactory.getLogger(WxEnterpriseController.class);
@Autowired @Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired @Autowired
...@@ -49,9 +62,15 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -49,9 +62,15 @@ public class WxEnterpriseController extends WebBaseController{
private DepartmentApiService departmentApiService; private DepartmentApiService departmentApiService;
@Autowired @Autowired
private StoreService storeService; private StoreService storeService;
@Autowired
private QywxTokenManageService qywxTokenManageService;
@Autowired
private WxApplicationApiService wxApplicationApiService;
@Autowired
private Config config;
//授权企业列表 //授权企业列表
@HttpLimit
@IgnoreLogin @IgnoreLogin
@RequestMapping("wx-enterprise-list") @RequestMapping("wx-enterprise-list")
public HaobanResponse wxEnterpriseList() { public HaobanResponse wxEnterpriseList() {
...@@ -67,7 +86,7 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -67,7 +86,7 @@ public class WxEnterpriseController extends WebBaseController{
EnterpriseDTO enterpriseDTO = map.get(dto.getEnterpriseId()); EnterpriseDTO enterpriseDTO = map.get(dto.getEnterpriseId());
if(enterpriseDTO!=null){ if(enterpriseDTO!=null){
dto.setEnterpriseName(enterpriseDTO.getEnterpriseName()); dto.setEnterpriseName(enterpriseDTO.getEnterpriseName());
dto.setEnterpriseLogo(enterpriseDTO.getImageUrl()); dto.setEnterpriseLogo(enterpriseDTO.getQcloudImageUrl());
} }
} }
} }
...@@ -83,6 +102,33 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -83,6 +102,33 @@ public class WxEnterpriseController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
wxEnterpriseDTO.setSmallVersion("免费版");
return resultResponse(HaoBanErrCode.ERR_1,wxEnterpriseDTO);
}
//企业信息
@IgnoreLogin
@RequestMapping("wxEnterprise-refresh")
public HaobanResponse enterpriseRefresh(String wxEnterpriseId) {
if(StringUtils.isEmpty(wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_1);
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
if(wxEnterpriseDTO == null){
return resultResponse(HaoBanErrCode.ERR_10012);
}
QywxCorpInfoDTO dto = qywxTokenManageService.getCorpInfo(wxEnterpriseDTO.getCorpid(), config.getSuiteId());
Long verifiedEndTime = dto.getVerifiedEndTime();
if(dto == null){
return resultResponse(HaoBanErrCode.ERR_10012);
}
logger.info("【企业同步】dto={}",JSON.toJSONString(dto));
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, dto);
if(verifiedEndTime != null){
wxDTO.setVerifiedEndTime(new Date(verifiedEndTime * 1000));
}
wxDTO.setWxEnterpriseId(wxEnterpriseId);
wxEnterpriseApiService.update(wxDTO);
return resultResponse(HaoBanErrCode.ERR_1,wxEnterpriseDTO); return resultResponse(HaoBanErrCode.ERR_1,wxEnterpriseDTO);
} }
//gic企业列表 //gic企业列表
......
...@@ -80,6 +80,8 @@ public enum HaoBanErrCode { ...@@ -80,6 +80,8 @@ public enum HaoBanErrCode {
ERR_10009(10009,"门店不存在"), ERR_10009(10009,"门店不存在"),
ERR_10010(10010,"企业微信无关联的gic企业"), ERR_10010(10010,"企业微信无关联的gic企业"),
ERR_10011(10011,"正在同步中,请等待结束再操作"), ERR_10011(10011,"正在同步中,请等待结束再操作"),
ERR_10012(10012,"企业微信不存在"),
ERR_DEFINE(-888, "自定义错误"), ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code"); ERR_OTHER(-999, "未知错误code");
......
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
public class AdminRoleVO implements Serializable{
private String userName;
private String userPhone;
private String DepartmentName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getDepartmentName() {
return DepartmentName;
}
public void setDepartmentName(String departmentName) {
DepartmentName = departmentName;
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
import java.util.List;
public class AdminVO implements Serializable{
private String roleId;
private String roleName;
private List<AdminRoleVO> roleUser;
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public List<AdminRoleVO> getRoleUser() {
return roleUser;
}
public void setRoleUser(List<AdminRoleVO> roleUser) {
this.roleUser = roleUser;
}
}
...@@ -32,6 +32,8 @@ public class DepartmentVO implements Serializable{ ...@@ -32,6 +32,8 @@ public class DepartmentVO implements Serializable{
private Boolean hasSonNode; private Boolean hasSonNode;
private String enterpriseId; private String enterpriseId;
private String relatedCode;
public String getDepartmentId() { public String getDepartmentId() {
return departmentId; return departmentId;
...@@ -144,6 +146,14 @@ public class DepartmentVO implements Serializable{ ...@@ -144,6 +146,14 @@ public class DepartmentVO implements Serializable{
public void setEnterpriseId(String enterpriseId) { public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public String getRelatedCode() {
return relatedCode;
}
public void setRelatedCode(String relatedCode) {
this.relatedCode = relatedCode;
}
......
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
import com.gic.haoban.manage.api.dto.StaffDTO;
public class StaffVO implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String staffName;
private String phoneNumber;
private String nationCode;
private String postion;
private String departmentName;
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getNationCode() {
return nationCode;
}
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
public String getPostion() {
return postion;
}
public void setPostion(String postion) {
this.postion = postion;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
...@@ -50,5 +50,6 @@ ...@@ -50,5 +50,6 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.AuditSettingApiService" id="auditSettingApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.AuditSettingApiService" id="auditSettingApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DictApiService" id="dictApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.DictApiService" id="dictApiService"/>
<dubbo:reference interface="com.gic.wechat.token.api.service.QywxTokenManageService" id="qywxTokenManageService"/>
</beans> </beans>
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.ApplicationDTO; import com.gic.haoban.manage.api.dto.ApplicationDTO;
import com.gic.haoban.manage.api.dto.ApplicationSettingDTO;
import com.gic.haoban.manage.api.service.ApplicationApiService; import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.api.service.ApplicationSettingApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RestController @RestController
...@@ -18,18 +24,33 @@ public class ApplicationController extends WebBaseController{ ...@@ -18,18 +24,33 @@ public class ApplicationController extends WebBaseController{
@Autowired @Autowired
private ApplicationApiService applicationApiService; private ApplicationApiService applicationApiService;
@Autowired
private ApplicationSettingApiService applicationSettingApiService;
@RequestMapping("application-list") @RequestMapping("application-list")
public HaobanResponse applicationList() { public HaobanResponse applicationList(String wxEnterpriseId) {
List<ApplicationDTO> list = applicationApiService.listApplication(); List<ApplicationDTO> list = applicationApiService.listApplication();
List<String> applicationIds = list.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
List<ApplicationSettingDTO> settings = applicationSettingApiService.listOpenByWxEnterpriseIdAndApplicationIds(wxEnterpriseId, applicationIds);
List<String> openApplicationIds = new ArrayList<String>();
if(CollectionUtil.isNotEmpty(settings)){
openApplicationIds = settings.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
}
Iterator<ApplicationDTO> it = list.listIterator(); Iterator<ApplicationDTO> it = list.listIterator();
while(it.hasNext()){ while(it.hasNext()){
ApplicationDTO app = it.next(); ApplicationDTO app = it.next();
if(!openApplicationIds.contains(app.getApplicationId())){
it.remove();
continue ;
}
if("通讯录".equals(app.getApplicationName())){ if("通讯录".equals(app.getApplicationName())){
it.remove(); it.remove();
continue ;
} }
} }
return resultResponse(HaoBanErrCode.ERR_1,list); return resultResponse(HaoBanErrCode.ERR_1,list);
} }
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.contacts.manage.api.service.StoreService;
import com.gic.haoban.manage.api.dto.UserLoginLogDTO; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.config.Config; import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.interceptor.WebInterceptor; import com.gic.haoban.manage.web.qo.MemberLoginQo;
import com.gic.haoban.manage.web.vo.AppStaffVo; import com.gic.haoban.manage.web.vo.AppStaffVo;
import com.gic.haoban.manage.web.vo.InfoVo; import com.gic.haoban.manage.web.vo.InfoVo;
import com.gic.haoban.manage.web.vo.StoreVO;
import com.gic.wechat.api.dto.qywx.UserDTO; import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService; import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
@RestController @RestController
public class InfoController extends WebBaseController{ public class InfoController extends WebBaseController{
...@@ -42,49 +42,121 @@ public class InfoController extends WebBaseController{ ...@@ -42,49 +42,121 @@ public class InfoController extends WebBaseController{
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired @Autowired
private WxEnterpriseApiService wxEnterpriseApiService; private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired
private QywxUserApiService qywxUserApiService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private com.gic.enterprise.api.service.StoreService storeService;
private static Logger logger= LoggerFactory.getLogger(InfoController.class); private static Logger logger= LoggerFactory.getLogger(InfoController.class);
@Autowired @Autowired
private Config config; private Config config;
@RequestMapping("get-info-by-code") @RequestMapping("get-info-by-code")
public HaobanResponse getInfoByCode(String code) { public HaobanResponse getInfoByCode(String code) {
String userDTOJson = qywxCorpApiService.getCodeSession(config.getWxSuiteid(),code); String userDTOJson = qywxCorpApiService.getCodeSession(config.getWxSuiteid(),code);
logger.info("userDTOJson=============>{}",userDTOJson); logger.info("userDTOJson=============>{}",userDTOJson);
UserDTO user = JSON.parseObject(userDTOJson, UserDTO.class); UserDTO user = JSON.parseObject(userDTOJson, UserDTO.class);
if(user == null) { if(user == null) {
return resultResponse(HaoBanErrCode.ERR_6); return resultResponse(HaoBanErrCode.ERR_6);
} }
String userId = user.getUserid(); String userId = user.getUserid();
String corpId = user.getCorpid(); String corpId = user.getCorpid();
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getEnterpriseBycorpId(corpId); WxEnterpriseDTO enterprise = wxEnterpriseApiService.getEnterpriseBycorpId(corpId);
StaffDTO loginStaff = null; StaffDTO loginStaff = null;
if(enterprise != null){ if(enterprise != null){
loginStaff = staffApiService.selectByUserIdAndEnterpriseId(userId,enterprise.getWxEnterpriseId()); loginStaff = staffApiService.selectByUserIdAndEnterpriseId(userId,enterprise.getWxEnterpriseId());
} }
if(loginStaff == null){ if(loginStaff == null){
if(enterprise != null){ if(enterprise != null){
staffApiService.wxGetAdd(userId,enterprise.getWxEnterpriseId()); staffApiService.wxGetAdd(userId,enterprise.getWxEnterpriseId());
loginStaff = staffApiService.selectByUserIdAndEnterpriseId(userId,enterprise.getWxEnterpriseId()); loginStaff = staffApiService.selectByUserIdAndEnterpriseId(userId,enterprise.getWxEnterpriseId());
} }
} }
if(loginStaff == null){ if(loginStaff == null){
return resultResponse(HaoBanErrCode.ERR_600001); return resultResponse(HaoBanErrCode.ERR_600001);
} }
String wxEnterpriseId = loginStaff.getWxEnterpriseId(); String wxEnterpriseId = loginStaff.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
String accesstoken = qywxCorpApiService.getCorpAccessToken(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid()); String accesstoken = qywxCorpApiService.getCorpAccessToken(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid());
InfoVo infoVo = new InfoVo(); InfoVo infoVo = new InfoVo();
infoVo.setAccessToken(accesstoken); infoVo.setAccessToken(accesstoken);
infoVo.setStaffId(loginStaff.getStaffId()); infoVo.setStaffId(loginStaff.getStaffId());
infoVo.setWxEnterpriseId(wxEnterpriseId); infoVo.setWxEnterpriseId(wxEnterpriseId);
infoVo.setStaffName(loginStaff.getStaffName()); infoVo.setStaffName(loginStaff.getStaffName());
infoVo.setPhoneNumber(loginStaff.getPhoneNumber()); infoVo.setPhoneNumber(loginStaff.getPhoneNumber());
infoVo.setNationcode(loginStaff.getNationCode()); infoVo.setNationcode(loginStaff.getNationCode());
return resultResponse(HaoBanErrCode.ERR_1,infoVo); return resultResponse(HaoBanErrCode.ERR_1,infoVo);
} }
@RequestMapping("get-user-by-member-code")
public HaobanResponse getInfoByMemberCode(String code, String gicEnterpriseId, String userId) {
EnterpriseDetailDTO enterpriseDetailDTO = wxEnterpriseRelatedApiService.getByEnterpriseId(gicEnterpriseId);
if (enterpriseDetailDTO == null) {
logger.info("改企业没有关系好办:{}", gicEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_500001);
}
WxEnterpriseDTO enterpriseDTO = wxEnterpriseApiService.getOne(enterpriseDetailDTO.getWxEnterpriseId());
if (enterpriseDetailDTO == null) {
logger.info("改企业不存在:{}", gicEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_400002);
}
MemberLoginQo user = new MemberLoginQo();
if (StringUtils.isBlank(userId)) {
String userDTOJson = qywxUserApiService.getUserByCode(enterpriseDTO.getCorpid(), enterpriseDTO.getMemberSecret(), code);
logger.info("会员微信登录信息=============>{}", userDTOJson);
user = JSON.parseObject(userDTOJson, MemberLoginQo.class);
if (user == null) {
return resultResponse(HaoBanErrCode.ERR_6);
}
} else {
user.setUserId(userId);
}
StaffDTO staffDTO = staffApiService.selectByUserIdAndEnterpriseId(user.getUserId(), enterpriseDTO.getWxEnterpriseId());
if (staffDTO == null) {
logger.info("成员不存在");
return resultResponse(HaoBanErrCode.ERR_6);
}
ServiceResponse<List<DepartmentDTO>> response = departmentApiService.listStoreListByStaffId(staffDTO.getStaffId());
List<DepartmentDTO> result = response.getResult();
List<StoreVO> retList = new ArrayList<>();
if (response.getCode() == 1 && CollectionUtils.isNotEmpty(result)) {
result.stream().forEach(dto -> {
StoreVO VO = new StoreVO();
VO.setDepartmentId(dto.getDepartmentId());
VO.setStoreId(dto.getRelatedId());//为空,则无该值
VO.setStoreName(dto.getDepartmentName());
VO.setWxEnterpriseId(dto.getWxEnterpriseId());
VO.setStoreImg("");//先置空
if (org.apache.commons.lang.StringUtils.isNotBlank(dto.getRelatedId())) {
StoreDTO storeDTO = storeService.getStore(dto.getRelatedId());
if (storeDTO != null) {
VO.setEnterpriseId(storeDTO.getEnterpriseId());
VO.setStoreImg(storeDTO.getImageUrl());//先置空
}
}
VO.setCreateTime(dto.getCreateTime());
retList.add(VO);
});
user.setStoreList(retList);
}
return resultResponse(HaoBanErrCode.ERR_1, user);
}
@RequestMapping("save-user-login-log") @RequestMapping("save-user-login-log")
public HaobanResponse saveUserLoginLog(UserLoginLogDTO userLoginLogDTO) { public HaobanResponse saveUserLoginLog(UserLoginLogDTO userLoginLogDTO) {
......
...@@ -39,6 +39,7 @@ import com.gic.haoban.manage.api.dto.AuditSettingDTO; ...@@ -39,6 +39,7 @@ import com.gic.haoban.manage.api.dto.AuditSettingDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService; import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
...@@ -179,7 +180,7 @@ public class StoreController extends WebBaseController{ ...@@ -179,7 +180,7 @@ public class StoreController extends WebBaseController{
HaobanDataDTO HaobanDataDTO = haobanDataApiService.getSaleDataByDate(enterpriseId, storeId, date); HaobanDataDTO HaobanDataDTO = haobanDataApiService.getSaleDataByDate(enterpriseId, storeId, date);
return resultResponse(HaoBanErrCode.ERR_1,HaobanDataDTO); return resultResponse(HaoBanErrCode.ERR_1,HaobanDataDTO);
} }
//获取首页销售数据 //获取省市区
@IgnoreLogin @IgnoreLogin
@RequestMapping("/get-area-list") @RequestMapping("/get-area-list")
public HaobanResponse getArea(Integer type,String id) { public HaobanResponse getArea(Integer type,String id) {
...@@ -239,13 +240,24 @@ public class StoreController extends WebBaseController{ ...@@ -239,13 +240,24 @@ public class StoreController extends WebBaseController{
if(StringUtils.isBlank(newValue)){ if(StringUtils.isBlank(newValue)){
newValue = ""; newValue = "";
} }
//增加判断是否是门店面积数字合法
if(StoreFieldEnum.STORE_AREA.getValue().equals(changeField)){
try {
Double.parseDouble(newValue);
} catch (Exception e) {
return resultResponse(HaoBanErrCode.ERR_400019);
}
}
StoreDTO store = storeService.getStore(storeId); StoreDTO store = storeService.getStore(storeId);
String enterpriseId = store.getEnterpriseId(); String enterpriseId = store.getEnterpriseId();
logger.info("==================aaaa"); logger.info("==================aaaa");
AuditSettingDTO auditSettingDTO = auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId); AuditSettingDTO auditSettingDTO = auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId);
logger.info("==================bbb"); logger.info("==================bbb");
//默认审核 //默认开启审核
int auditFlag = 0; int auditFlag = 1;
if(auditSettingDTO != null){ if(auditSettingDTO != null){
auditFlag = auditSettingDTO.getAuditFlag(); auditFlag = auditSettingDTO.getAuditFlag();
} }
...@@ -281,7 +293,7 @@ public class StoreController extends WebBaseController{ ...@@ -281,7 +293,7 @@ public class StoreController extends WebBaseController{
List<String> imgList = imgDTOList.stream().map(s->s.getQcloudImageUrl()).collect(Collectors.toList()); List<String> imgList = imgDTOList.stream().map(s->s.getQcloudImageUrl()).collect(Collectors.toList());
vo.setImgList(imgList); vo.setImgList(imgList);
} }
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
if(vo.getOpenTime()!=null){ if(vo.getOpenTime()!=null){
vo.setOpenTimeStr(sdf.format(vo.getOpenTime())); vo.setOpenTimeStr(sdf.format(vo.getOpenTime()));
} }
...@@ -297,6 +309,9 @@ public class StoreController extends WebBaseController{ ...@@ -297,6 +309,9 @@ public class StoreController extends WebBaseController{
AuditSettingDTO auditSettingDTO = auditSettingApiService.findSettingByWxEnterpriseId(staffDepartmentRelatedDTO.getWxEnterpriseId()); AuditSettingDTO auditSettingDTO = auditSettingApiService.findSettingByWxEnterpriseId(staffDepartmentRelatedDTO.getWxEnterpriseId());
vo.setAuditFlag(auditSettingDTO == null?0:auditSettingDTO.getAuditFlag()); vo.setAuditFlag(auditSettingDTO == null?0:auditSettingDTO.getAuditFlag());
if(vo.getStoreArea() == null||vo.getStoreArea()==-1 ){
vo.setStoreArea(-1d);
}
return resultResponse(HaoBanErrCode.ERR_1,vo); return resultResponse(HaoBanErrCode.ERR_1,vo);
} }
......
...@@ -90,6 +90,7 @@ public enum HaoBanErrCode { ...@@ -90,6 +90,7 @@ public enum HaoBanErrCode {
ERR_400016(400016, "提交人不存在"), ERR_400016(400016, "提交人不存在"),
ERR_400017(400017, "成员不存在"), ERR_400017(400017, "成员不存在"),
ERR_400018(400018, "已有待审核的门店字段信息提交,请等待审核完再提交"), ERR_400018(400018, "已有待审核的门店字段信息提交,请等待审核完再提交"),
ERR_400019(400019, "门店面积不合法"),
/** /**
* 文件不存在 * 文件不存在
......
package com.gic.haoban.manage.web.qo;
import com.gic.haoban.manage.web.vo.StoreVO;
import java.io.Serializable;
import java.util.List;
/**
* Created 2020/4/1.
*
* @author hua
*/
public class MemberLoginQo implements Serializable {
private String userId;
private String corpId;
private List<StoreVO> storeList;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getCorpId() {
return corpId;
}
public void setCorpId(String corpId) {
this.corpId = corpId;
}
public List<StoreVO> getStoreList() {
return storeList;
}
public void setStoreList(List<StoreVO> storeList) {
this.storeList = storeList;
}
}
...@@ -28,10 +28,12 @@ ...@@ -28,10 +28,12 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseApiService" id="wxEnterpriseApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseApiService" id="wxEnterpriseApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxCorpApiService" id="qywxCorpApiService"/> <dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxCorpApiService" id="qywxCorpApiService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxUserApiService" id="qywxUserApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.BindApiService" id="bindApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.BindApiService" id="bindApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.AuditApiService" id="auditApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.AuditApiService" id="auditApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.AuditSettingApiService" id="auditSettingApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.AuditSettingApiService" id="auditSettingApiService"/>
<dubbo:reference interface="com.gic.dict.api.service.ManagerDictService" id="managerDictService"/> <dubbo:reference interface="com.gic.dict.api.service.ManagerDictService" id="managerDictService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" id="applicationSettingApiService"/>
<dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/> <dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/>
......
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