Commit 8f08f539 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
parents b297668c 3abc7c7c
...@@ -91,9 +91,10 @@ public class AuthController { ...@@ -91,9 +91,10 @@ public class AuthController {
public JSONObject register(@RequestParam(value="username",defaultValue="")String username, public JSONObject register(@RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password, @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code",defaultValue="")String code)throws Exception{ @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel)throws Exception{
log.info(username+"----require register..."); log.info(username+"----require register...");
JSONObject data=appAuthService.register(username,mobilecode,password,code); JSONObject data=appAuthService.register(username,mobilecode,password,code,channel);
if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){ if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){
JwtAuthenticationRequest authenticationRequest=new JwtAuthenticationRequest(); JwtAuthenticationRequest authenticationRequest=new JwtAuthenticationRequest();
authenticationRequest.setUsername(username); authenticationRequest.setUsername(username);
...@@ -114,11 +115,12 @@ public class AuthController { ...@@ -114,11 +115,12 @@ public class AuthController {
@RequestParam(value="unionid",defaultValue="")String unionid, @RequestParam(value="unionid",defaultValue="")String unionid,
@RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="type",defaultValue="0")Integer type,
@RequestParam(value="isQQ",defaultValue="0")Integer isQQ, @RequestParam(value="isQQ",defaultValue="0")Integer isQQ,
@RequestParam(value="code",defaultValue="")String code @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel
)throws Exception{ )throws Exception{
log.info(username+"----require wxregister..."); log.info(username+"----require wxregister...");
JSONObject data=appAuthService.wxregister( username, mobilecode, password, nickname, JSONObject data=appAuthService.wxregister( username, mobilecode, password, nickname,
headimgurl, openid, unionid,type,isQQ,code); headimgurl, openid, unionid,type,isQQ,code,channel);
if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){ if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){
JSONObject result=data.getJSONObject("data"); JSONObject result=data.getJSONObject("data");
if(result==null){ if(result==null){
......
...@@ -34,13 +34,16 @@ public interface IUserService { ...@@ -34,13 +34,16 @@ public interface IUserService {
public JSONObject register( @RequestParam(value="username",defaultValue="")String username, public JSONObject register( @RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password, @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code")String code); @RequestParam(value="code")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel);
@RequestMapping(value = "/api/app/user/wxregister", method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/wxregister", method = RequestMethod.POST)
public JSONObject wxregister( public JSONObject wxregister(
@RequestParam(value="username")String username,@RequestParam(value="mobilecode")String mobilecode, @RequestParam(value="username")String username,@RequestParam(value="mobilecode")String mobilecode,
@RequestParam(value="password")String password,@RequestParam(value="nickname")String nickname, @RequestParam(value="password")String password,@RequestParam(value="nickname")String nickname,
@RequestParam(value="headimgurl")String headimgurl,@RequestParam(value="openid")String openid, @RequestParam(value="headimgurl")String headimgurl,@RequestParam(value="openid")String openid,
@RequestParam(value="unionid")String unionid,@RequestParam(value="type")Integer type,@RequestParam(value="isQQ")Integer isQQ,@RequestParam(value="code")String code); @RequestParam(value="unionid")String unionid,@RequestParam(value="type")Integer type,
@RequestParam(value="isQQ")Integer isQQ,@RequestParam(value="code")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel);
@RequestMapping(value = "/api/app/user/checkBindWechat",method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/checkBindWechat",method = RequestMethod.POST)
public JSONObject checkBindWechat( @RequestParam(value="username")String username); public JSONObject checkBindWechat( @RequestParam(value="username")String username);
@RequestMapping(value = "/api/app/user/wxlogin",method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/wxlogin",method = RequestMethod.POST)
......
...@@ -14,8 +14,8 @@ public interface AuthService { ...@@ -14,8 +14,8 @@ public interface AuthService {
String refresh(String oldToken) throws Exception; String refresh(String oldToken) throws Exception;
void validate(String token) throws Exception; void validate(String token) throws Exception;
JSONObject sendsms(String username, Integer type) throws Exception; JSONObject sendsms(String username, Integer type) throws Exception;
JSONObject register(String username, String mobilecode, String password,String code) throws Exception; JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception;
JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code) throws Exception; JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel) throws Exception;
JSONObject checkBindWechat(String username) throws Exception; JSONObject checkBindWechat(String username) throws Exception;
JSONObject wxlogin(String openid,Integer isQQ,String code) throws Exception; JSONObject wxlogin(String openid,Integer isQQ,String code) throws Exception;
JSONObject tlogin(String username, String password,String mobilecode,Integer type,String code) throws Exception; JSONObject tlogin(String username, String password,String mobilecode,Integer type,String code) throws Exception;
......
...@@ -74,13 +74,13 @@ public class AppAuthServiceImpl implements AuthService { ...@@ -74,13 +74,13 @@ public class AppAuthServiceImpl implements AuthService {
} }
@Override @Override
public JSONObject register(String username, String mobilecode, String password,String code) throws Exception { public JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception {
return userService.register(username,mobilecode,password,code); return userService.register(username,mobilecode,password,code,channel);
} }
@Override @Override
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code) throws Exception { public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel) throws Exception {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code); return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code,channel);
} }
@Override @Override
......
...@@ -69,13 +69,13 @@ public class AuthServiceImpl implements AuthService { ...@@ -69,13 +69,13 @@ public class AuthServiceImpl implements AuthService {
return userService.sendsms(username,type); return userService.sendsms(username,type);
} }
@Override @Override
public JSONObject register(String username, String mobilecode, String password,String code) throws Exception { public JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception {
return userService.register(username,mobilecode,password,code); return userService.register(username,mobilecode,password,code,channel);
} }
@Override @Override
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code) throws Exception { public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel) throws Exception {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code); return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code,channel);
} }
@Override @Override
......
package com.github.wxiaoqi.security.admin.dto; package com.github.wxiaoqi.security.admin.dto;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Set; import java.util.Set;
...@@ -8,6 +10,8 @@ import java.util.Set; ...@@ -8,6 +10,8 @@ import java.util.Set;
* 用户信息表 * 用户信息表
*/ */
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
public class AppUserManageDTO { public class AppUserManageDTO {
/** /**
* 每页条数 * 每页条数
......
...@@ -48,8 +48,7 @@ public class BaseUserMemberExport implements Serializable { ...@@ -48,8 +48,7 @@ public class BaseUserMemberExport implements Serializable {
private Integer beforeDiscount; private Integer beforeDiscount;
@Column(name = "source") @Column(name = "source")
private Integer source; private Integer source;
@Column(name = "user_id")
private Integer userId;
} }
...@@ -192,4 +192,5 @@ public interface UserFeign { ...@@ -192,4 +192,5 @@ public interface UserFeign {
@GetMapping("/public/getUsersByUserIdList") @GetMapping("/public/getUsersByUserIdList")
ObjectRestResponse<List<AppUserVo>> getByUserIdList(@RequestParam("userIds") List<Integer> userIds); ObjectRestResponse<List<AppUserVo>> getByUserIdList(@RequestParam("userIds") List<Integer> userIds);
} }
...@@ -36,6 +36,10 @@ import java.util.stream.Collectors; ...@@ -36,6 +36,10 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail> { public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail> {
@Override @Override
@CacheClear(pre = "user{1.userid}") @CacheClear(pre = "user{1.userid}")
public void updateSelectiveById(AppUserDetail entity) { public void updateSelectiveById(AppUserDetail entity) {
...@@ -209,7 +213,8 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -209,7 +213,8 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
} }
public List<UserBo> findUserBosByPhones(List<String> phones) { public List<UserBo> findUserBosByPhones(List<String> phones) {
List<UserBo> userBoList = mapper.findUserBosByPhones(phones); List<UserBo> userBoList = mapper.findUserBosByPhones(phones);
return CollectionUtils.isEmpty(userBoList)?Collections.emptyList():userBoList; return CollectionUtils.isEmpty(userBoList)?Collections.emptyList():userBoList;
} }
} }
...@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.admin.dto.AccountBindDTO; ...@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.admin.dto.AccountBindDTO;
import com.github.wxiaoqi.security.admin.bo.UserBo; import com.github.wxiaoqi.security.admin.bo.UserBo;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail; import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation; import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import com.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
...@@ -66,6 +67,9 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -66,6 +67,9 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
@Autowired @Autowired
private AppUserSellingWaterBiz appUserSellingWaterBiz; private AppUserSellingWaterBiz appUserSellingWaterBiz;
@Autowired
private AppUserPositionTempBiz appUserPositionTempBiz;
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
@Override @Override
public void insertSelective(AppUserLogin entity) { public void insertSelective(AppUserLogin entity) {
...@@ -252,7 +256,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -252,7 +256,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
public Map<String, Integer> findPhoneAndUserIdMapByPhonesForDel(List<String> phones) { public Map<String, Integer> findPhoneAndUserIdMapByPhonesForDel(List<String> phones) {
Example example = new Example(AppUserLogin.class); Example example = new Example(AppUserLogin.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andIn("username",phones); criteria.andIn("username", phones);
List<AppUserLogin> appUserLogins = mapper.selectByExample(example); List<AppUserLogin> appUserLogins = mapper.selectByExample(example);
Map<String, Integer> phoneAndUserIdMap = null; Map<String, Integer> phoneAndUserIdMap = null;
if (CollectionUtils.isNotEmpty(appUserLogins)) { if (CollectionUtils.isNotEmpty(appUserLogins)) {
...@@ -345,8 +349,8 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -345,8 +349,8 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
} }
public List<AppUserLogin> getUserByUsernameAndRealName(String username, String realName) { public List<AppUserLogin> getUserByUsernameAndRealName(String username, String realName) {
return mapper.getUserByUsernameAndRealName(username,realName); return mapper.getUserByUsernameAndRealName(username, realName);
} }
...@@ -421,7 +425,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -421,7 +425,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
public List<Integer> findAppuser(String phone, String leaderPhone, String name) { public List<Integer> findAppuser(String phone, String leaderPhone, String name) {
List<Integer> memberIds = null; List<Integer> memberIds = null;
//1.根据leader手机号查询userid //1.根据leader手机号查询userid
boolean isNoNullLeaderPhone = StringUtils.isNotEmpty(leaderPhone) && leaderPhone.trim().length()>0; boolean isNoNullLeaderPhone = StringUtils.isNotEmpty(leaderPhone) && leaderPhone.trim().length() > 0;
if (isNoNullLeaderPhone) { if (isNoNullLeaderPhone) {
List<AppUserLogin> appUserLogins = mapper.selectbyPhones(Arrays.asList(leaderPhone)); List<AppUserLogin> appUserLogins = mapper.selectbyPhones(Arrays.asList(leaderPhone));
Integer leaderId = null; Integer leaderId = null;
...@@ -429,34 +433,34 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -429,34 +433,34 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
leaderId = appUserLogins.get(0).getId(); leaderId = appUserLogins.get(0).getId();
//2.根据leader userId查询下级 userid //2.根据leader userId查询下级 userid
if (Objects.nonNull(leaderId)) { if (Objects.nonNull(leaderId)) {
memberIds = appUserSellingWaterBiz.findMemberIdByLeaderIdAndOrdreType(leaderId,3); memberIds = appUserSellingWaterBiz.findMemberIdByLeaderIdAndOrdreType(leaderId, 3);
if(CollectionUtils.isEmpty(memberIds)){ if (CollectionUtils.isEmpty(memberIds)) {
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
}
} }
} }
}
List<Integer> userIds = mapper.findAppUser(phone, name, memberIds); List<Integer> userIds = mapper.findAppUser(phone, name, memberIds);
return userIds==null?Collections.EMPTY_LIST:userIds; return userIds == null ? Collections.EMPTY_LIST : userIds;
} }
public List<UserBo> findUserDetailInfo(List<UserBo> userBos) { public List<UserBo> findUserDetailInfo(List<UserBo> userBos) {
Map<String, Integer> userIdAndFacilitateIdMap = userBos.stream().filter(x->Objects.nonNull(x.getFacilitateId())).collect(Collectors.toMap(UserBo::getOrderNo, UserBo::getFacilitateId)); Map<String, Integer> userIdAndFacilitateIdMap = userBos.stream().filter(x -> Objects.nonNull(x.getFacilitateId())).collect(Collectors.toMap(UserBo::getOrderNo, UserBo::getFacilitateId));
List<Integer> userIdList = userBos.stream().map(UserBo::getUserId).distinct().collect(Collectors.toList()); List<Integer> userIdList = userBos.stream().map(UserBo::getUserId).distinct().collect(Collectors.toList());
//查询上级人 //查询上级人
List<AppUserRelation> appUserRelationList = appUserRelationBiz.findLeaderByUserIds(userIdList); List<AppUserRelation> appUserRelationList = appUserRelationBiz.findLeaderByUserIds(userIdList);
Map<Integer, Integer> memberIdAndParentMap = appUserRelationList.stream().collect(Collectors.toMap(AppUserRelation::getUserId, AppUserRelation::getParentId)); Map<Integer, Integer> memberIdAndParentMap = appUserRelationList.stream().collect(Collectors.toMap(AppUserRelation::getUserId, AppUserRelation::getParentId));
List<Integer> uids = new ArrayList<>(); List<Integer> uids = new ArrayList<>();
uids.addAll(userIdAndFacilitateIdMap==null?Collections.EMPTY_LIST:userIdList); uids.addAll(userIdAndFacilitateIdMap == null ? Collections.EMPTY_LIST : userIdList);
uids.addAll(userIdAndFacilitateIdMap==null?Collections.EMPTY_LIST:userIdAndFacilitateIdMap.values()); uids.addAll(userIdAndFacilitateIdMap == null ? Collections.EMPTY_LIST : userIdAndFacilitateIdMap.values());
uids.addAll(memberIdAndParentMap==null?Collections.EMPTY_LIST:memberIdAndParentMap.values()); uids.addAll(memberIdAndParentMap == null ? Collections.EMPTY_LIST : memberIdAndParentMap.values());
List<UserBo> userBoList = mapper.selectByUserIds(uids); List<UserBo> userBoList = mapper.selectByUserIds(uids);
Map<Integer, UserBo> userMap = userBoList==null?Collections.EMPTY_MAP:userBoList.stream().collect(Collectors.toMap(UserBo::getUserId, Function.identity())); Map<Integer, UserBo> userMap = userBoList == null ? Collections.EMPTY_MAP : userBoList.stream().collect(Collectors.toMap(UserBo::getUserId, Function.identity()));
if (userMap.isEmpty()){ if (userMap.isEmpty()) {
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
...@@ -479,4 +483,22 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -479,4 +483,22 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
} }
return userBos; return userBos;
} }
@CacheClear(pre = "user{1}")
public void updateUserPosition(Integer userId, Integer positionId, Integer operatorId) {
AppUserLogin appUserLogin = selectById(userId);
if (appUserLogin != null) {
String phone = appUserLogin.getUsername();
appUserPositionTempBiz.findUserPositionTemp(phone, positionId, operatorId);
}
appUserDetailBiz.updateUserPositionByUserId(userId, positionId);
}
@CacheClear(pre = "user{1}")
public void updateUserPosition(Integer userId, Integer positionId) {
appUserDetailBiz.updateUserPositionByUserId(userId, positionId);
}
} }
...@@ -7,7 +7,6 @@ import com.github.wxiaoqi.security.admin.entity.AppUserDetail; ...@@ -7,7 +7,6 @@ import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.mapper.AppUserDetailMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserDetailMapper;
import com.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper;
import com.github.wxiaoqi.security.admin.mapper.BaseUserMemberMapper;
import com.github.wxiaoqi.security.admin.vo.AppUserManageVo; import com.github.wxiaoqi.security.admin.vo.AppUserManageVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
...@@ -26,7 +25,7 @@ import tk.mybatis.mapper.entity.Example; ...@@ -26,7 +25,7 @@ import tk.mybatis.mapper.entity.Example;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -55,6 +54,10 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -55,6 +54,10 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
* @return * @return
*/ */
public PageInfo<AppUserManageVo> findAllByQuery(AppUserManageDTO appUserManageDTO) { public PageInfo<AppUserManageVo> findAllByQuery(AppUserManageDTO appUserManageDTO) {
if (Objects.nonNull(appUserManageDTO.getRegistrationTimeEnd())){
long registerEndTime = appUserManageDTO.getRegistrationTimeEnd()+(24*60*60);
appUserManageDTO.setRegistrationTimeEnd(registerEndTime);
}
PageHelper.startPage(appUserManageDTO.getPage(), appUserManageDTO.getLimit()); PageHelper.startPage(appUserManageDTO.getPage(), appUserManageDTO.getLimit());
List<AppUserManageVo> appUserManageVos = mapper.selectAppUser(appUserManageDTO); List<AppUserManageVo> appUserManageVos = mapper.selectAppUser(appUserManageDTO);
PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos); PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos);
......
...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp; ...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp;
import com.github.wxiaoqi.security.admin.mapper.AppUserPositionChangeRecordMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserPositionChangeRecordMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.NonNull;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jsoup.select.Evaluator; import org.jsoup.select.Evaluator;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -39,7 +40,7 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang ...@@ -39,7 +40,7 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang
public static final int POSITION_CHANGE = 3; public static final int POSITION_CHANGE = 3;
public static final int COMPANY_CHANGE = 4; public static final int COMPANY_CHANGE = 4;
public static final int USER_LEAVE_COMPANT = 5; public static final int USER_LEAVE_COMPANT = 5;
public static final int USER_AND_ADD_COMPANY=6; public static final int USER_AND_ADD_COMPANY = 6;
/** /**
* 变更记录表插入 * 变更记录表插入
...@@ -103,12 +104,16 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang ...@@ -103,12 +104,16 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang
/** /**
* 员工复职 * 员工复职
*
* @param userPositionTemp * @param userPositionTemp
* @param updUserId * @param updUserId
*/ */
public void andAddJoinJobRecord(AppUserPositionTempDTO userPositionTemp, Integer updUserId) { public void andAddJoinJobRecord(AppUserPositionTempDTO userPositionTemp, Integer updUserId) {
AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord(); AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord();
appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone()); appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone());
if (userPositionTemp.getPositionId() != null) {
appUserPositionChangeRecord.setNewPositionId(userPositionTemp.getPositionId());
}
appUserPositionChangeRecord.setUserName(userPositionTemp.getName()); appUserPositionChangeRecord.setUserName(userPositionTemp.getName());
appUserPositionChangeRecord.setRelTime(userPositionTemp.getRelTime()); appUserPositionChangeRecord.setRelTime(userPositionTemp.getRelTime());
appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis())); appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis()));
...@@ -117,9 +122,24 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang ...@@ -117,9 +122,24 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang
mapper.insert(appUserPositionChangeRecord); mapper.insert(appUserPositionChangeRecord);
} }
/**
* APP用户修改身份
*
* @param userPositionTemp
* @param updUserId
*/
public void andAddJoinJobRecord(AppUserPositionTemp userPositionTemp, Integer updUserId) {
AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord();
appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone());
if (userPositionTemp.getPositionId() != null) {
appUserPositionChangeRecord.setNewPositionId(userPositionTemp.getPositionId());
}
appUserPositionChangeRecord.setUserName(userPositionTemp.getName());
appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis()));
appUserPositionChangeRecord.setJobRemark(USER_AND_ADD_COMPANY);
appUserPositionChangeRecord.setOperatorId(updUserId);
mapper.insert(appUserPositionChangeRecord);
}
/** /**
......
...@@ -3,10 +3,7 @@ package com.github.wxiaoqi.security.admin.biz; ...@@ -3,10 +3,7 @@ package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionChangeRecordDTO; import com.github.wxiaoqi.security.admin.dto.AppUserPositionChangeRecordDTO;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO; import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempFindDTO; import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempFindDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserJobLevel; import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp;
import com.github.wxiaoqi.security.admin.mapper.AppUserPositionTempMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserPositionTempMapper;
import com.github.wxiaoqi.security.admin.vo.AppUserPositionTempVo; import com.github.wxiaoqi.security.admin.vo.AppUserPositionTempVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
...@@ -15,6 +12,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -15,6 +12,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xxfc.platform.im.utils.BeanUtil;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -29,6 +27,7 @@ import org.springframework.stereotype.Service; ...@@ -29,6 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -66,6 +65,9 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -66,6 +65,9 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
@Autowired @Autowired
AppUserJobLevelBiz jobLevelBiz; AppUserJobLevelBiz jobLevelBiz;
@Autowired
AppUserDetailBiz appUserDetailBiz;
@Autowired @Autowired
AppUserPositionChangeRecordBiz appUserPositionChangeRecordBiz; AppUserPositionChangeRecordBiz appUserPositionChangeRecordBiz;
...@@ -140,6 +142,9 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -140,6 +142,9 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
if (Objects.nonNull(appUserPositionTempFindDTO.getCompanyId())) { if (Objects.nonNull(appUserPositionTempFindDTO.getCompanyId())) {
criteria.andEqualTo("companyId", appUserPositionTempFindDTO.getCompanyId()); criteria.andEqualTo("companyId", appUserPositionTempFindDTO.getCompanyId());
} }
if (Objects.nonNull(appUserPositionTempFindDTO.getPositionId())) {
criteria.andEqualTo("positionId", appUserPositionTempFindDTO.getPositionId());
}
if (Objects.nonNull(appUserPositionTempFindDTO.getStatus())) { if (Objects.nonNull(appUserPositionTempFindDTO.getStatus())) {
if (DataStatus.USERED.code == appUserPositionTempFindDTO.getStatus()) { if (DataStatus.USERED.code == appUserPositionTempFindDTO.getStatus()) {
criteria.andNotEqualTo("userId", 0); criteria.andNotEqualTo("userId", 0);
...@@ -297,6 +302,8 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -297,6 +302,8 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
return result; return result;
} }
private enum DataStatus { private enum DataStatus {
USERED(1), NO_USERED(0); USERED(1), NO_USERED(0);
private int code; private int code;
...@@ -374,7 +381,6 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -374,7 +381,6 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
return mapper.getUserIdByParentCompany(parentCompanyId); return mapper.getUserIdByParentCompany(parentCompanyId);
} }
/** /**
* 员工信息修改,插入变更记录表 * 员工信息修改,插入变更记录表
* zuoyh * zuoyh
...@@ -416,8 +422,14 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -416,8 +422,14 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
} else { } else {
userPositionTemp.setUpdTime(nowTime); userPositionTemp.setUpdTime(nowTime);
updateSelectiveById(userPositionTemp); updateSelectiveById(userPositionTemp);
appUserPositionTempDTO.setPositionId(6);
appUserPositionChangeRecordBiz.addPositionChangeRecord(userPositionTemp, oldData, operatorId, appUserPositionTempDTO.getRelTime()); appUserPositionChangeRecordBiz.addPositionChangeRecord(userPositionTemp, oldData, operatorId, appUserPositionTempDTO.getRelTime());
} }
//用户表更改其身份
AppUserLogin userLogin = loginBiz.checkeUserLogin(userPositionTemp.getPhone());
if (userLogin != null) {
loginBiz.updateUserPosition(userLogin.getId(), appUserPositionTempDTO.getPositionId());
}
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -433,6 +445,12 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -433,6 +445,12 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
updateSelectiveById(userPositionTemp); updateSelectiveById(userPositionTemp);
userPositionTemp.setUpdTime(System.currentTimeMillis()); userPositionTemp.setUpdTime(System.currentTimeMillis());
appUserPositionChangeRecordBiz.andAddJoinJobRecord(appUserPositionTempDTO, operatorId); appUserPositionChangeRecordBiz.andAddJoinJobRecord(appUserPositionTempDTO, operatorId);
//用户表更改其身份
AppUserLogin userLogin = loginBiz.checkeUserLogin(userPositionTemp.getPhone());
if (userLogin != null) {
AppUserDetail appUserDetail = new AppUserDetail();
loginBiz.updateUserPosition(userLogin.getId(), appUserPositionTempDTO.getPositionId(), operatorId);
}
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -445,4 +463,26 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A ...@@ -445,4 +463,26 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
return appUserPositionChangeRecordBiz.findPositionChangeRecord(userPositionTemp); return appUserPositionChangeRecordBiz.findPositionChangeRecord(userPositionTemp);
} }
/**
* zuoyh
* app用户表修改职位,员工记录表对应查询
*/
public void findUserPositionTemp(String phone, Integer positionId, Integer operatorId) {
Timestamp relTime = new Timestamp(System.currentTimeMillis());
Example example = new Example(AppUserPositionTemp.class);
example.createCriteria().andEqualTo("phone", phone);
List<AppUserPositionTemp> list = mapper.selectByExample(example);
AppUserPositionTemp newAppUserPositionTemp = new AppUserPositionTemp();
if (list.size()>0) {
newAppUserPositionTemp =list.get(0);
if (newAppUserPositionTemp != null) {
AppUserPositionTemp odlAppUserPositionTemp = new AppUserPositionTemp();
BeanUtils.copyProperties(newAppUserPositionTemp, odlAppUserPositionTemp);
newAppUserPositionTemp.setPositionId(positionId);
newAppUserPositionTemp.setUpdTime(System.currentTimeMillis());
mapper.updateByPrimaryKey(newAppUserPositionTemp);
appUserPositionChangeRecordBiz.addPositionChangeRecord(newAppUserPositionTemp, odlAppUserPositionTemp, operatorId, relTime);
}
}
}
} }
...@@ -79,7 +79,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem ...@@ -79,7 +79,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
@Cache(key = "user:member{1}") @Cache(key = "user:member{1}")
public UserMemberVo getMemberInfoByUserId(Integer userId) { public UserMemberVo getMemberInfoByUserId(Integer userId) {
return mapper.getInfoByUserId(userId); return mapper.getInfoByUserId(userId);
} }
//更新会员信息 //更新会员信息
@Override @Override
...@@ -309,22 +309,28 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem ...@@ -309,22 +309,28 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
mapper.deleteByExample(example); mapper.deleteByExample(example);
} }
private void setModifyData(UserMemberVo beforeMember, BaseUserMember aftereMember) throws Exception { private void setModifyData(UserMemberVo beforeMember, BaseUserMember aftereMember) throws Exception {
log.info("保存修改会员记录={}",aftereMember); log.info("保存修改会员记录={}",aftereMember);
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)); IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
log.info("token信息={}",infoFromToken);
if (beforeMember==null) {
beforeMember = new UserMemberVo();
}
UserMemberVo finalBeforeMember = beforeMember;
executorService.submit(()->{ executorService.submit(()->{
try { try {
AppUserVo qppUser = detailBiz.getUserInfoById(beforeMember.getUserId()); AppUserVo qppUser = detailBiz.getUserInfoById(aftereMember.getUserId());
BaseUserMemberExport baseUserMemberExport = BaseUserMemberExport BaseUserMemberExport baseUserMemberExport = BaseUserMemberExport
.builder() .builder()
.username(qppUser.getUsername()) .username(qppUser.getUsername())
.beforeMemberLevel(beforeMember.getMemberLevel()) .beforeMemberLevel(finalBeforeMember.getMemberLevel())
.memberLevel(aftereMember.getMemberLevel()) .memberLevel(aftereMember.getMemberLevel())
.totalNumber(aftereMember.getTotalNumber() - beforeMember.getTotalNumber()) .totalNumber(aftereMember.getTotalNumber() - (finalBeforeMember.getTotalNumber()==null?0:finalBeforeMember.getTotalNumber()))
.rentFreeDays(aftereMember.getRentFreeDays() - beforeMember.getRentFreeDays()) .rentFreeDays(aftereMember.getRentFreeDays() - (finalBeforeMember.getRentFreeDays()==null?0:finalBeforeMember.getRentFreeDays()))
.beforeDiscount(beforeMember.getDiscount()) .beforeDiscount(finalBeforeMember.getDiscount())
.discount(aftereMember.getDiscount()) .discount(aftereMember.getDiscount())
.status(1) .status(1)
.userId(beforeMember.getUserId()) .userId(aftereMember.getUserId())
.crtTime(System.currentTimeMillis()) .crtTime(System.currentTimeMillis())
.crtId(Integer.valueOf(infoFromToken.getId())) .crtId(Integer.valueOf(infoFromToken.getId()))
.crtName(infoFromToken.getUniqueName()) .crtName(infoFromToken.getUniqueName())
......
...@@ -17,4 +17,5 @@ public interface AppUserPositionMapper extends Mapper<AppUserPosition>, IdListMa ...@@ -17,4 +17,5 @@ public interface AppUserPositionMapper extends Mapper<AppUserPosition>, IdListMa
AppUserPosition getExtractByUserId(@Param("userId")Integer userId); AppUserPosition getExtractByUserId(@Param("userId")Integer userId);
} }
...@@ -22,5 +22,7 @@ public interface AppUserPositionTempMapper extends Mapper<AppUserPositionTemp> { ...@@ -22,5 +22,7 @@ public interface AppUserPositionTempMapper extends Mapper<AppUserPositionTemp> {
@Insert("INSERT IGNORE INTO `app_user_position_temp`(`user_id`,`phone`,`name`,`position_id`,`crt_time`)VALUES(#{userId},#{phone},#{name},#{positionId},#{crtTime})") @Insert("INSERT IGNORE INTO `app_user_position_temp`(`user_id`,`phone`,`name`,`position_id`,`crt_time`)VALUES(#{userId},#{phone},#{name},#{positionId},#{crtTime})")
void insertWithIgnoreRepeat(AppUserPositionTemp appUserPositionTemp); void insertWithIgnoreRepeat(AppUserPositionTemp appUserPositionTemp);
List<Integer> getUserIdByParentCompany(@Param("parentCompanyId") List<Integer> parentCompanyId); List<Integer> getUserIdByParentCompany(@Param("parentCompanyId") List<Integer> parentCompanyId);
} }
...@@ -12,22 +12,28 @@ import com.github.wxiaoqi.security.admin.entity.User; ...@@ -12,22 +12,28 @@ import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.vo.AppUserManageVo; import com.github.wxiaoqi.security.admin.vo.AppUserManageVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Set; import java.util.Set;
/** /**
* app用户管理类 * app用户管理类
*
* @author Administrator * @author Administrator
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("appUsersManage") @RequestMapping("appUsersManage")
public class AppUsersManageController extends BaseController<AppUserManageBiz,AppUserManage> { public class AppUsersManageController extends BaseController<AppUserManageBiz, AppUserManage> {
@Autowired @Autowired
private AppUserLoginBiz appUserLoginBiz; private AppUserLoginBiz appUserLoginBiz;
...@@ -44,66 +50,76 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -44,66 +50,76 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired @Autowired
private VehicleFeign vehicleFeign; private VehicleFeign vehicleFeign;
private Integer ALL_PERMISSIONS=1; @Autowired
private UserAuthUtil userAuthUtil;
private Integer ALL_PERMISSIONS = 1;
/** /**
* 查询所有,获取详细信息 * 查询所有
*
* @return * @return
*/ */
@PostMapping("/findAll") @PostMapping("/findAll")
public ObjectRestResponse<PageInfo<AppUserManageVo>> findAllByQuery(@RequestBody AppUserManageDTO appUserManageDTO) throws Exception { public ObjectRestResponse<PageInfo<AppUserManageVo>> findAllByQuery(@RequestBody AppUserManageDTO appUserManageDTO) throws Exception {
String token = userAuthConfig.getToken(request); String token = userAuthConfig.getToken(request);
ObjectRestResponse objectRestResponse = publicController.userinfoByToken(token); ObjectRestResponse objectRestResponse = publicController.userinfoByToken(token);
User user = (User) objectRestResponse.getData(); User user = (User) objectRestResponse.getData();
if (user==null){ if (user == null) {
throw new BaseException("User error!"); throw new BaseException("User error!");
} }
if (ALL_PERMISSIONS.equals(user.getDataAll())) { if (ALL_PERMISSIONS.equals(user.getDataAll())) {
return ObjectRestResponse.succ(baseBiz.findAllByQuery(appUserManageDTO)); return ObjectRestResponse.succ(baseBiz.findAllByQuery(appUserManageDTO));
} }
ObjectRestResponse<Set<Integer>> setObjectRestResponse = vehicleFeign.corporationCity(user.getDataZone(), user.getDataCompany()); ObjectRestResponse<Set<Integer>> setObjectRestResponse = vehicleFeign.corporationCity(user.getDataZone(), user.getDataCompany());
Set<Integer> cityList = setObjectRestResponse.getData(); Set<Integer> cityList = setObjectRestResponse.getData();
appUserManageDTO.setCitySet(cityList); appUserManageDTO.setCitySet(cityList);
return ObjectRestResponse.succ(baseBiz.findAllByQueryAndCity(appUserManageDTO)); return ObjectRestResponse.succ(baseBiz.findAllByQueryAndCity(appUserManageDTO));
} }
/** /**
* 根据用户id获取用户详情 * 根据用户id获取用户详情
*
* @param userId * @param userId
* @return * @return
*/ */
@GetMapping("/user_info/{id}") @GetMapping("/user_info/{id}")
public ObjectRestResponse<AppUserManageVo> findUserInfo(@PathVariable(value = "id") Integer userId){ public ObjectRestResponse<AppUserManageVo> findUserInfo(@PathVariable(value = "id") Integer userId) {
AppUserManageVo appUserManageVo = baseBiz.findUserInfoById(userId); AppUserManageVo appUserManageVo = baseBiz.findUserInfoById(userId);
return ObjectRestResponse.succ(appUserManageVo); return ObjectRestResponse.succ(appUserManageVo);
} }
/** /**
* 查询一条 * 查询一条
*
* @param id * @param id
* @return * @return
*/ */
@GetMapping("/findOneById/{id}") @GetMapping("/findOneById/{id}")
public ObjectRestResponse<AppUserVo> findOneById(@PathVariable Integer id){ public ObjectRestResponse<AppUserVo> findOneById(@PathVariable Integer id) {
return ObjectRestResponse.succ(baseBiz.findOneById(id)); return ObjectRestResponse.succ(baseBiz.findOneById(id));
} }
/** /**
* 保存 * 保存
*
* @param appUserVo * @param appUserVo
* @return * @return
*/ */
@PostMapping("/save") @PostMapping("/save")
public ObjectRestResponse save(@RequestBody AppUserVo appUserVo){ public ObjectRestResponse save(@RequestBody AppUserVo appUserVo) {
baseBiz.save(appUserVo); baseBiz.save(appUserVo);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
/** /**
* 禁用 * 禁用
*
* @param appUserId * @param appUserId
* @return * @return
*/ */
@PutMapping("/disable/{appUserId}") @PutMapping("/disable/{appUserId}")
public ObjectRestResponse disable(@PathVariable("appUserId") Integer appUserId){ public ObjectRestResponse disable(@PathVariable("appUserId") Integer appUserId) {
AppUserLogin appUserLogin = new AppUserLogin(); AppUserLogin appUserLogin = new AppUserLogin();
appUserLogin.setStatus(Status.FORBIDDEN); appUserLogin.setStatus(Status.FORBIDDEN);
appUserLogin.setId(appUserId); appUserLogin.setId(appUserId);
...@@ -113,11 +129,12 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -113,11 +129,12 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
/** /**
* 取消禁用 * 取消禁用
*
* @param appUserId * @param appUserId
* @return * @return
*/ */
@PutMapping("/available/{appUserId}") @PutMapping("/available/{appUserId}")
public ObjectRestResponse available(@PathVariable("appUserId") Integer appUserId){ public ObjectRestResponse available(@PathVariable("appUserId") Integer appUserId) {
AppUserLogin appUserLogin = new AppUserLogin(); AppUserLogin appUserLogin = new AppUserLogin();
appUserLogin.setStatus(Status.AVAILABLE); appUserLogin.setStatus(Status.AVAILABLE);
appUserLogin.setId(appUserId); appUserLogin.setId(appUserId);
...@@ -127,19 +144,27 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -127,19 +144,27 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
/** /**
* 删除用户 * 删除用户
*
* @param id * @param id
* @return * @return
*/ */
@DeleteMapping("/deleteById/{id}") @DeleteMapping("/deleteById/{id}")
public ObjectRestResponse deleteById(@PathVariable Integer id){ public ObjectRestResponse deleteById(@PathVariable Integer id) {
appUserLoginBiz.deleteAppUserById(id); appUserLoginBiz.deleteAppUserById(id);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@PutMapping("/user_position") @PutMapping("/user_position")
public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id,@RequestParam("positionId") Integer positionId){ public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id, @RequestParam("positionId") Integer positionId, HttpServletRequest request) {
appUserDetailBiz.updateUserPositionByUserId(id,positionId); try {
return ObjectRestResponse.succ(); IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer operatorId = Integer.valueOf(infoFromToken.getId());
appUserLoginBiz.updateUserPosition(id, positionId,operatorId);
return ObjectRestResponse.succ();
} catch (Exception e) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
}
} }
}
}
...@@ -114,7 +114,7 @@ public class AppUserPositionController { ...@@ -114,7 +114,7 @@ public class AppUserPositionController {
try { try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)); IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer operatorId = Integer.valueOf(infoFromToken.getId()); Integer operatorId = Integer.valueOf(infoFromToken.getId());
return ObjectRestResponse.succ(appUserPositionTempBiz.addUserPositionChangeRecord(appUserPositionTempDTO.getChangeStatus(), appUserPositionTempDTO, operatorId)); return ObjectRestResponse.succ(appUserPositionTempBiz.addUserPositionChangeRecord(appUserPositionTempDTO.getChangeStatus(), appUserPositionTempDTO, operatorId)) ;
} catch (Exception e) { } catch (Exception e) {
log.error("修改失败【{}】", e); log.error("修改失败【{}】", e);
throw new BaseException("修改失败"); throw new BaseException("修改失败");
...@@ -138,7 +138,8 @@ public class AppUserPositionController { ...@@ -138,7 +138,8 @@ public class AppUserPositionController {
try { try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)); IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer operatorId = Integer.valueOf(infoFromToken.getId()); Integer operatorId = Integer.valueOf(infoFromToken.getId());
return ObjectRestResponse.succ(appUserPositionTempBiz.andAddUserPositionChangeRecord(appUserPositionTempDTO, operatorId)); appUserPositionTempBiz.andAddUserPositionChangeRecord(appUserPositionTempDTO, operatorId);
return ObjectRestResponse.succ();
} catch (Exception e) { } catch (Exception e) {
log.error("修改失败【{}】", e); log.error("修改失败【{}】", e);
throw new BaseException("修改失败"); throw new BaseException("修改失败");
......
...@@ -89,12 +89,13 @@ public class AppUserRest { ...@@ -89,12 +89,13 @@ public class AppUserRest {
@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password, @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code",defaultValue="")String code @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel
){ ){
//默认昵称 //默认昵称
String nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000); String nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000);
return appPermissionService.register(username, password, SystemConfig.USER_HEADER_URL_DEFAULT,nickname, return appPermissionService.register(username, password, SystemConfig.USER_HEADER_URL_DEFAULT,nickname,
mobilecode, null, null,0,code); mobilecode, null, null,0,code,channel);
} }
...@@ -122,7 +123,8 @@ public class AppUserRest { ...@@ -122,7 +123,8 @@ public class AppUserRest {
@RequestParam(value="unionid",defaultValue="")String unionid, @RequestParam(value="unionid",defaultValue="")String unionid,
@RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="type",defaultValue="0")Integer type,
@RequestParam(value="isQQ",defaultValue="0")Integer isQQ, @RequestParam(value="isQQ",defaultValue="0")Integer isQQ,
@RequestParam(value="code",defaultValue="")String code @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel
){ ){
if(StringUtils.isBlank(headimgurl)){ if(StringUtils.isBlank(headimgurl)){
headimgurl=SystemConfig.USER_HEADER_URL_DEFAULT; headimgurl=SystemConfig.USER_HEADER_URL_DEFAULT;
...@@ -130,7 +132,7 @@ public class AppUserRest { ...@@ -130,7 +132,7 @@ public class AppUserRest {
if(StringUtils.isBlank(nickname)){ if(StringUtils.isBlank(nickname)){
nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000); nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000);
} }
return appPermissionService.weCahtRegister(username,password,openid, unionid,nickname,headimgurl,type,mobilecode,isQQ,code); return appPermissionService.weCahtRegister(username,password,openid, unionid,nickname,headimgurl,type,mobilecode,isQQ,code,channel);
} }
/** /**
* 手机号码检测是否已绑定 * 手机号码检测是否已绑定
......
...@@ -245,7 +245,7 @@ public class AppPermissionService { ...@@ -245,7 +245,7 @@ public class AppPermissionService {
*/ */
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public JSONObject register(String username, String password, String headimgurl, public JSONObject register(String username, String password, String headimgurl,
String nickname, String mobilecode, String openId, String unionid, Integer type,String code) { String nickname, String mobilecode, String openId, String unionid, Integer type,String code,Integer channel) {
log.info("register------code====="+code+"----开始进入方法---time===="+System.currentTimeMillis()/1000L); log.info("register------code====="+code+"----开始进入方法---time===="+System.currentTimeMillis()/1000L);
String activityCode = null; String activityCode = null;
// 判断参数和验证码 // 判断参数和验证码
...@@ -333,6 +333,7 @@ public class AppPermissionService { ...@@ -333,6 +333,7 @@ public class AppPermissionService {
} }
//生成邀请码 长度改为8 不然重复率太高 //生成邀请码 长度改为8 不然重复率太高
rsUserDetail.setCode(ReferralCodeUtil.encode(userid)); rsUserDetail.setCode(ReferralCodeUtil.encode(userid));
rsUserDetail.setChannel(channel);
appUserDetailBiz.insertSelective(rsUserDetail); appUserDetailBiz.insertSelective(rsUserDetail);
log.info("注册:新增用户详情: " + userid+"---time===="+System.currentTimeMillis()/1000L); log.info("注册:新增用户详情: " + userid+"---time===="+System.currentTimeMillis()/1000L);
/* //绑定上下线关系 /* //绑定上下线关系
...@@ -556,7 +557,7 @@ public class AppPermissionService { ...@@ -556,7 +557,7 @@ public class AppPermissionService {
*/ */
@Transactional @Transactional
public JSONObject weCahtRegister(String username, String password, String openId, public JSONObject weCahtRegister(String username, String password, String openId,
String unionid, String nickname, String headimgurl, int type, String mobilecode, Integer isQQ,String code) { String unionid, String nickname, String headimgurl, int type, String mobilecode, Integer isQQ,String code,Integer channel) {
// 校验参数和验证码 // 校验参数和验证码
if (StringUtils.isBlank(username) || StringUtils.isBlank(mobilecode)) { if (StringUtils.isBlank(username) || StringUtils.isBlank(mobilecode)) {
return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空"); return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空");
...@@ -614,6 +615,7 @@ public class AppPermissionService { ...@@ -614,6 +615,7 @@ public class AppPermissionService {
userDetail.setUpdatetime(now); userDetail.setUpdatetime(now);
userDetail.setIsdel(0); userDetail.setIsdel(0);
userDetail.setCrtHost(getIp()); userDetail.setCrtHost(getIp());
userDetail.setChannel(channel);
//setCreateIPInfo(userDetail); //setCreateIPInfo(userDetail);
appUserDetailBiz.insertSelective(userDetail); appUserDetailBiz.insertSelective(userDetail);
...@@ -647,7 +649,7 @@ public class AppPermissionService { ...@@ -647,7 +649,7 @@ public class AppPermissionService {
} }
} else if (type == 2) { // 新增 } else if (type == 2) { // 新增
JSONObject register = register(username, password, headimgurl, nickname, mobilecode, JSONObject register = register(username, password, headimgurl, nickname, mobilecode,
openId, unionid, isQQ,code); openId, unionid, isQQ,code,channel);
if (register.getInteger("status") != ResultCode.SUCCESS_CODE) { if (register.getInteger("status") != ResultCode.SUCCESS_CODE) {
if (register.getInteger("status") == ResultCode.EXIST_CODE) { if (register.getInteger("status") == ResultCode.EXIST_CODE) {
return JsonResultUtil.createFailedResult(ResultCode.EXIST_CODE, "用户已存在"); return JsonResultUtil.createFailedResult(ResultCode.EXIST_CODE, "用户已存在");
......
...@@ -205,6 +205,7 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper, Act ...@@ -205,6 +205,7 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper, Act
} }
} }
} else { } else {
// 获取锁失败 // 获取锁失败
log.info("tryLock fail, key = [{}]", lockKey); log.info("tryLock fail, key = [{}]", lockKey);
} }
......
package com.xxfc.platform.app.entity;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* 下载记录
* @author Administrator
*/
@Data
public class AppDownloadRecord {
@Id
@GeneratedValue(generator ="JDBC")
private Integer id;
private String source;
private Date creTime;
private String terminal;
}
package com.xxfc.platform.app.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.app.entity.AppDownloadRecord;
import com.xxfc.platform.app.mapper.AppDownloadRecordMapper;
import org.springframework.stereotype.Service;
/**
* @author hf
* @Date: 2019/12/19 15:47
* @Description:
*/
@Service
public class AppDownloadRecordBiz extends BaseBiz<AppDownloadRecordMapper, AppDownloadRecord> {
}
package com.xxfc.platform.app.mapper;
import com.xxfc.platform.app.entity.AppDownloadRecord;
import tk.mybatis.mapper.common.Mapper;
/**
* @Auther: Administrator
* @Date: 2019/12/19 15:49
* @Description:
*/
public interface AppDownloadRecordMapper extends Mapper<AppDownloadRecord> {
}
package com.xxfc.platform.app.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.app.biz.AppDownloadRecordBiz;
import com.xxfc.platform.app.entity.AppDownloadRecord;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
/**
* @Auther: Administrator
* @Date: 2019/12/19 15:46
* @Description:
*/
@RestController
@RequestMapping("/app/unauth/adr")
public class AppDownloadRecordController extends BaseController<AppDownloadRecordBiz, AppDownloadRecord> {
@Override
@ApiOperation("添加")
@PostMapping(value = "add")
public ObjectRestResponse<AppDownloadRecord> add(@RequestBody AppDownloadRecord appDownloadRecord ){
appDownloadRecord.setCreTime(new Date());
baseBiz.insertSelective(appDownloadRecord);
return ObjectRestResponse.succ();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.app.mapper.AppDownloadRecordMapper">
</mapper>
\ No newline at end of file
...@@ -70,16 +70,16 @@ ...@@ -70,16 +70,16 @@
and cst.tag_id=#{type} and cst.tag_id=#{type}
</if> </if>
<if test="addrProvince != null"> <if test="addrProvince != null">
and cs.`province`=#{proviceCode} and cs.`province`=#{addrProvince}
</if> </if>
<if test="addrCity != null"> <if test="addrCity != null">
and cs.`city`=#{cityCode} and cs.`city`=#{addrCity}
</if> </if>
<if test="name!=null and name!=''"> <if test="name!=null and name!=''">
and cs.`name` like concat('%',#{name},'%') and cs.`name` like concat('%',#{name},'%')
</if> </if>
<if test="keyWord!=null and keyWord!=''"> <if test="keyWord!=null and keyWord!=''">
and (cs.`name` like concat('%',#{keyWord},'%') or cs.address like concat('%',#{keyWord},'%') or `ct`.name like concat('%',#{keyWord},'%') ) and cs.`name` like concat('%',#{keyWord},'%')
</if> </if>
GROUP BY cs.id GROUP BY cs.id
order by cs.hot DESC,cs.crt_time DESC order by cs.hot DESC,cs.crt_time DESC
......
...@@ -96,7 +96,7 @@ public enum StatisticsStatusEnum { ...@@ -96,7 +96,7 @@ public enum StatisticsStatusEnum {
x.getPayWay() == null ? NO_PAY_WAY : x.getPayWay() x.getPayWay() == null ? NO_PAY_WAY : x.getPayWay()
, x.getHasPay())); , x.getHasPay()));
stisticsActiveState.add(x.getStateGroup()); stisticsActiveState.add(x.getStateGroup());
}).collect(Collectors.partitioningBy(x -> Objects.nonNull(x.getPayWay()), Collectors.groupingBy(OrderDTO::getStateGroup, Collectors.toList()))); }).collect(Collectors.partitioningBy(x -> Objects.equals(x.getHasPay(),1), Collectors.groupingBy(OrderDTO::getStateGroup, Collectors.toList())));
return stateGroupMap == null ? Collections.EMPTY_MAP : stateGroupMap; return stateGroupMap == null ? Collections.EMPTY_MAP : stateGroupMap;
} }
......
...@@ -154,6 +154,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -154,6 +154,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
dataCell.setCellStyle(cellStyle); dataCell.setCellStyle(cellStyle);
String sign = signs.get(cellIndex - 1); String sign = signs.get(cellIndex - 1);
List<OrderReceivedStatisticsVo> orderReceivedStatisticsVos = data.get(sign); List<OrderReceivedStatisticsVo> orderReceivedStatisticsVos = data.get(sign);
if (ReceivedStatisticsEnum.DAY.getWayCode() == statisticalWay){
orderReceivedStatisticsVos.sort(Comparator.comparing(OrderReceivedStatisticsVo::getDate));
}
if (ReceivedStatisticsEnum.WEEK.getWayCode() == statisticalWay){
orderReceivedStatisticsVos.sort(Comparator.comparing(OrderReceivedStatisticsVo::getWeekOfYear));
}
if (ReceivedStatisticsEnum.MONTH.getWayCode() == statisticalWay){
orderReceivedStatisticsVos.sort(Comparator.comparing(OrderReceivedStatisticsVo::getMonth));
}
if (CollectionUtils.isEmpty(orderReceivedStatisticsVos) || i > orderReceivedStatisticsVos.size()) { if (CollectionUtils.isEmpty(orderReceivedStatisticsVos) || i > orderReceivedStatisticsVos.size()) {
continue; continue;
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</resultMap> </resultMap>
<select id="selectOrderMemberReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics"> <select id="selectOrderMemberReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `date`,`year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`, select `date`,`year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`,
IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`, IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`,
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1 IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</select> </select>
<select id="selectOrderMemberReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics"> <select id="selectOrderMemberReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`, select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`,
IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`, IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`,
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1 IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</select> </select>
<select id="selectOrderMemberReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics"> <select id="selectOrderMemberReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount` select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`
,IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`, ,IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0) as `totalGoldQuantity`,
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1 IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</resultMap> </resultMap>
<select id="selectOrderReceivedStatisticsDateList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsDateList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</select> </select>
<select id="selectOrderReceivedStatisticsMonthList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsMonthList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</select> </select>
<select id="selectOrderReceivedStatisticsWeekOfYearList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsWeekOfYearList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<result property="crtTime" column="crt_time"/> <result property="crtTime" column="crt_time"/>
</resultMap> </resultMap>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics"> <select id="selectOrderRentVehicleReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1 select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</select> </select>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics"> <select id="selectOrderRentVehicleReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1 select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</select> </select>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics"> <select id="selectOrderRentVehicleReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1 select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</resultMap> </resultMap>
<select id="selectOrderTourReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics"> <select id="selectOrderTourReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1 select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</select> </select>
<select id="selectOrderTourReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics"> <select id="selectOrderTourReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1 select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</select> </select>
<select id="selectOrderTourReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics"> <select id="selectOrderTourReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1 select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
......
...@@ -127,14 +127,13 @@ public class ServiceTest { ...@@ -127,14 +127,13 @@ public class ServiceTest {
public void testOrderReceivedStatisticsJobHandler(){ public void testOrderReceivedStatisticsJobHandler(){
cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd"); cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd");
// cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1); // cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1);
/* orderReceivedStatisticsJobHandler.execute("2019-11-29");*/ // orderReceivedStatisticsJobHandler.execute("2019-10-08");
LocalDate startLocalDate = LocalDate.of(2019, 11, 30); LocalDate startLocalDate = LocalDate.of(2019, 10, 01);
LocalDate endLocalDate = LocalDate.of(2019,12,19); LocalDate endLocalDate = LocalDate.of(2019,12,20);
while (startLocalDate.isBefore(endLocalDate)){ while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1); startLocalDate = startLocalDate.plusDays(1);
orderReceivedStatisticsJobHandler.execute(dateStr); orderReceivedStatisticsJobHandler.execute(dateStr);
} }
} }
} }
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