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 {
public JSONObject register(@RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@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...");
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){
JwtAuthenticationRequest authenticationRequest=new JwtAuthenticationRequest();
authenticationRequest.setUsername(username);
......@@ -114,11 +115,12 @@ public class AuthController {
@RequestParam(value="unionid",defaultValue="")String unionid,
@RequestParam(value="type",defaultValue="0")Integer type,
@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{
log.info(username+"----require wxregister...");
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){
JSONObject result=data.getJSONObject("data");
if(result==null){
......
......@@ -34,13 +34,16 @@ public interface IUserService {
public JSONObject register( @RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@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)
public JSONObject wxregister(
@RequestParam(value="username")String username,@RequestParam(value="mobilecode")String mobilecode,
@RequestParam(value="password")String password,@RequestParam(value="nickname")String nickname,
@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)
public JSONObject checkBindWechat( @RequestParam(value="username")String username);
@RequestMapping(value = "/api/app/user/wxlogin",method = RequestMethod.POST)
......
......@@ -14,8 +14,8 @@ public interface AuthService {
String refresh(String oldToken) throws Exception;
void validate(String token) throws Exception;
JSONObject sendsms(String username, Integer type) throws Exception;
JSONObject register(String username, String mobilecode, String password,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) 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,Integer channel) throws Exception;
JSONObject checkBindWechat(String username) 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;
......
......@@ -74,13 +74,13 @@ public class AppAuthServiceImpl implements AuthService {
}
@Override
public JSONObject register(String username, String mobilecode, String password,String code) throws Exception {
return userService.register(username,mobilecode,password,code);
public JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception {
return userService.register(username,mobilecode,password,code,channel);
}
@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 {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code);
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,channel);
}
@Override
......
......@@ -69,13 +69,13 @@ public class AuthServiceImpl implements AuthService {
return userService.sendsms(username,type);
}
@Override
public JSONObject register(String username, String mobilecode, String password,String code) throws Exception {
return userService.register(username,mobilecode,password,code);
public JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception {
return userService.register(username,mobilecode,password,code,channel);
}
@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 {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code);
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,channel);
}
@Override
......
package com.github.wxiaoqi.security.admin.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Set;
......@@ -8,6 +10,8 @@ import java.util.Set;
* 用户信息表
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppUserManageDTO {
/**
* 每页条数
......
......@@ -48,8 +48,7 @@ public class BaseUserMemberExport implements Serializable {
private Integer beforeDiscount;
@Column(name = "source")
private Integer source;
@Column(name = "user_id")
private Integer userId;
}
......@@ -192,4 +192,5 @@ public interface UserFeign {
@GetMapping("/public/getUsersByUserIdList")
ObjectRestResponse<List<AppUserVo>> getByUserIdList(@RequestParam("userIds") List<Integer> userIds);
}
......@@ -36,6 +36,10 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class)
public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail> {
@Override
@CacheClear(pre = "user{1.userid}")
public void updateSelectiveById(AppUserDetail entity) {
......@@ -209,7 +213,8 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
}
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;
}
}
......@@ -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.entity.AppUserDetail;
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.mapper.AppUserLoginMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
......@@ -66,6 +67,9 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
@Autowired
private AppUserSellingWaterBiz appUserSellingWaterBiz;
@Autowired
private AppUserPositionTempBiz appUserPositionTempBiz;
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
@Override
public void insertSelective(AppUserLogin entity) {
......@@ -252,7 +256,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
public Map<String, Integer> findPhoneAndUserIdMapByPhonesForDel(List<String> phones) {
Example example = new Example(AppUserLogin.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIn("username",phones);
criteria.andIn("username", phones);
List<AppUserLogin> appUserLogins = mapper.selectByExample(example);
Map<String, Integer> phoneAndUserIdMap = null;
if (CollectionUtils.isNotEmpty(appUserLogins)) {
......@@ -345,8 +349,8 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
}
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> {
public List<Integer> findAppuser(String phone, String leaderPhone, String name) {
List<Integer> memberIds = null;
//1.根据leader手机号查询userid
boolean isNoNullLeaderPhone = StringUtils.isNotEmpty(leaderPhone) && leaderPhone.trim().length()>0;
boolean isNoNullLeaderPhone = StringUtils.isNotEmpty(leaderPhone) && leaderPhone.trim().length() > 0;
if (isNoNullLeaderPhone) {
List<AppUserLogin> appUserLogins = mapper.selectbyPhones(Arrays.asList(leaderPhone));
Integer leaderId = null;
......@@ -429,34 +433,34 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
return Collections.EMPTY_LIST;
}
leaderId = appUserLogins.get(0).getId();
//2.根据leader userId查询下级 userid
if (Objects.nonNull(leaderId)) {
memberIds = appUserSellingWaterBiz.findMemberIdByLeaderIdAndOrdreType(leaderId,3);
if(CollectionUtils.isEmpty(memberIds)){
return Collections.EMPTY_LIST;
//2.根据leader userId查询下级 userid
if (Objects.nonNull(leaderId)) {
memberIds = appUserSellingWaterBiz.findMemberIdByLeaderIdAndOrdreType(leaderId, 3);
if (CollectionUtils.isEmpty(memberIds)) {
return Collections.EMPTY_LIST;
}
}
}
}
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) {
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<AppUserRelation> appUserRelationList = appUserRelationBiz.findLeaderByUserIds(userIdList);
Map<Integer, Integer> memberIdAndParentMap = appUserRelationList.stream().collect(Collectors.toMap(AppUserRelation::getUserId, AppUserRelation::getParentId));
List<Integer> uids = new ArrayList<>();
uids.addAll(userIdAndFacilitateIdMap==null?Collections.EMPTY_LIST:userIdList);
uids.addAll(userIdAndFacilitateIdMap==null?Collections.EMPTY_LIST:userIdAndFacilitateIdMap.values());
uids.addAll(memberIdAndParentMap==null?Collections.EMPTY_LIST:memberIdAndParentMap.values());
List<Integer> uids = new ArrayList<>();
uids.addAll(userIdAndFacilitateIdMap == null ? Collections.EMPTY_LIST : userIdList);
uids.addAll(userIdAndFacilitateIdMap == null ? Collections.EMPTY_LIST : userIdAndFacilitateIdMap.values());
uids.addAll(memberIdAndParentMap == null ? Collections.EMPTY_LIST : memberIdAndParentMap.values());
List<UserBo> userBoList = mapper.selectByUserIds(uids);
Map<Integer, UserBo> userMap = userBoList==null?Collections.EMPTY_MAP:userBoList.stream().collect(Collectors.toMap(UserBo::getUserId, Function.identity()));
if (userMap.isEmpty()){
Map<Integer, UserBo> userMap = userBoList == null ? Collections.EMPTY_MAP : userBoList.stream().collect(Collectors.toMap(UserBo::getUserId, Function.identity()));
if (userMap.isEmpty()) {
return Collections.EMPTY_LIST;
}
......@@ -479,4 +483,22 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
}
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;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.mapper.AppUserDetailMapper;
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.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
......@@ -26,7 +25,7 @@ import tk.mybatis.mapper.entity.Example;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -55,6 +54,10 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
* @return
*/
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());
List<AppUserManageVo> appUserManageVos = mapper.selectAppUser(appUserManageDTO);
PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos);
......
......@@ -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.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.NonNull;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.select.Evaluator;
import org.springframework.beans.BeanUtils;
......@@ -39,7 +40,7 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang
public static final int POSITION_CHANGE = 3;
public static final int COMPANY_CHANGE = 4;
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
/**
* 员工复职
*
* @param userPositionTemp
* @param updUserId
*/
public void andAddJoinJobRecord(AppUserPositionTempDTO userPositionTemp, Integer updUserId) {
AppUserPositionChangeRecord appUserPositionChangeRecord = new AppUserPositionChangeRecord();
appUserPositionChangeRecord.setPhone(userPositionTemp.getPhone());
if (userPositionTemp.getPositionId() != null) {
appUserPositionChangeRecord.setNewPositionId(userPositionTemp.getPositionId());
}
appUserPositionChangeRecord.setUserName(userPositionTemp.getName());
appUserPositionChangeRecord.setRelTime(userPositionTemp.getRelTime());
appUserPositionChangeRecord.setCrtTime(new Timestamp(System.currentTimeMillis()));
......@@ -117,9 +122,24 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang
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;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionChangeRecordDTO;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO;
import com.github.wxiaoqi.security.admin.dto.AppUserPositionTempFindDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserJobLevel;
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.entity.*;
import com.github.wxiaoqi.security.admin.mapper.AppUserPositionTempMapper;
import com.github.wxiaoqi.security.admin.vo.AppUserPositionTempVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
......@@ -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.vo.PageDataVO;
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.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
......@@ -29,6 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
......@@ -66,6 +65,9 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
@Autowired
AppUserJobLevelBiz jobLevelBiz;
@Autowired
AppUserDetailBiz appUserDetailBiz;
@Autowired
AppUserPositionChangeRecordBiz appUserPositionChangeRecordBiz;
......@@ -140,6 +142,9 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
if (Objects.nonNull(appUserPositionTempFindDTO.getCompanyId())) {
criteria.andEqualTo("companyId", appUserPositionTempFindDTO.getCompanyId());
}
if (Objects.nonNull(appUserPositionTempFindDTO.getPositionId())) {
criteria.andEqualTo("positionId", appUserPositionTempFindDTO.getPositionId());
}
if (Objects.nonNull(appUserPositionTempFindDTO.getStatus())) {
if (DataStatus.USERED.code == appUserPositionTempFindDTO.getStatus()) {
criteria.andNotEqualTo("userId", 0);
......@@ -297,6 +302,8 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
return result;
}
private enum DataStatus {
USERED(1), NO_USERED(0);
private int code;
......@@ -374,7 +381,6 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
return mapper.getUserIdByParentCompany(parentCompanyId);
}
/**
* 员工信息修改,插入变更记录表
* zuoyh
......@@ -416,8 +422,14 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
} else {
userPositionTemp.setUpdTime(nowTime);
updateSelectiveById(userPositionTemp);
appUserPositionTempDTO.setPositionId(6);
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();
}
......@@ -433,6 +445,12 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
updateSelectiveById(userPositionTemp);
userPositionTemp.setUpdTime(System.currentTimeMillis());
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();
}
......@@ -445,4 +463,26 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
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
@Cache(key = "user:member{1}")
public UserMemberVo getMemberInfoByUserId(Integer userId) {
return mapper.getInfoByUserId(userId);
}
}
//更新会员信息
@Override
......@@ -309,22 +309,28 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
mapper.deleteByExample(example);
}
private void setModifyData(UserMemberVo beforeMember, BaseUserMember aftereMember) throws Exception {
log.info("保存修改会员记录={}",aftereMember);
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
log.info("token信息={}",infoFromToken);
if (beforeMember==null) {
beforeMember = new UserMemberVo();
}
UserMemberVo finalBeforeMember = beforeMember;
executorService.submit(()->{
try {
AppUserVo qppUser = detailBiz.getUserInfoById(beforeMember.getUserId());
AppUserVo qppUser = detailBiz.getUserInfoById(aftereMember.getUserId());
BaseUserMemberExport baseUserMemberExport = BaseUserMemberExport
.builder()
.username(qppUser.getUsername())
.beforeMemberLevel(beforeMember.getMemberLevel())
.beforeMemberLevel(finalBeforeMember.getMemberLevel())
.memberLevel(aftereMember.getMemberLevel())
.totalNumber(aftereMember.getTotalNumber() - beforeMember.getTotalNumber())
.rentFreeDays(aftereMember.getRentFreeDays() - beforeMember.getRentFreeDays())
.beforeDiscount(beforeMember.getDiscount())
.totalNumber(aftereMember.getTotalNumber() - (finalBeforeMember.getTotalNumber()==null?0:finalBeforeMember.getTotalNumber()))
.rentFreeDays(aftereMember.getRentFreeDays() - (finalBeforeMember.getRentFreeDays()==null?0:finalBeforeMember.getRentFreeDays()))
.beforeDiscount(finalBeforeMember.getDiscount())
.discount(aftereMember.getDiscount())
.status(1)
.userId(beforeMember.getUserId())
.userId(aftereMember.getUserId())
.crtTime(System.currentTimeMillis())
.crtId(Integer.valueOf(infoFromToken.getId()))
.crtName(infoFromToken.getUniqueName())
......
......@@ -17,4 +17,5 @@ public interface AppUserPositionMapper extends Mapper<AppUserPosition>, IdListMa
AppUserPosition getExtractByUserId(@Param("userId")Integer userId);
}
......@@ -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})")
void insertWithIgnoreRepeat(AppUserPositionTemp appUserPositionTemp);
List<Integer> getUserIdByParentCompany(@Param("parentCompanyId") List<Integer> parentCompanyId);
}
......@@ -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.AppUserVo;
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.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Set;
/**
* app用户管理类
*
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping("appUsersManage")
public class AppUsersManageController extends BaseController<AppUserManageBiz,AppUserManage> {
public class AppUsersManageController extends BaseController<AppUserManageBiz, AppUserManage> {
@Autowired
private AppUserLoginBiz appUserLoginBiz;
......@@ -44,66 +50,76 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired
private VehicleFeign vehicleFeign;
private Integer ALL_PERMISSIONS=1;
@Autowired
private UserAuthUtil userAuthUtil;
private Integer ALL_PERMISSIONS = 1;
/**
* 查询所有,获取详细信息
* 查询所有
*
* @return
*/
@PostMapping("/findAll")
public ObjectRestResponse<PageInfo<AppUserManageVo>> findAllByQuery(@RequestBody AppUserManageDTO appUserManageDTO) throws Exception {
String token = userAuthConfig.getToken(request);
ObjectRestResponse objectRestResponse = publicController.userinfoByToken(token);
User user = (User) objectRestResponse.getData();
if (user==null){
User user = (User) objectRestResponse.getData();
if (user == null) {
throw new BaseException("User error!");
}
if (ALL_PERMISSIONS.equals(user.getDataAll())) {
return ObjectRestResponse.succ(baseBiz.findAllByQuery(appUserManageDTO));
}
ObjectRestResponse<Set<Integer>> setObjectRestResponse = vehicleFeign.corporationCity(user.getDataZone(), user.getDataCompany());
Set<Integer> cityList = setObjectRestResponse.getData();
Set<Integer> cityList = setObjectRestResponse.getData();
appUserManageDTO.setCitySet(cityList);
return ObjectRestResponse.succ(baseBiz.findAllByQueryAndCity(appUserManageDTO));
return ObjectRestResponse.succ(baseBiz.findAllByQueryAndCity(appUserManageDTO));
}
/**
* 根据用户id获取用户详情
*
* @param userId
* @return
*/
@GetMapping("/user_info/{id}")
public ObjectRestResponse<AppUserManageVo> findUserInfo(@PathVariable(value = "id") Integer userId){
AppUserManageVo appUserManageVo = baseBiz.findUserInfoById(userId);
return ObjectRestResponse.succ(appUserManageVo);
public ObjectRestResponse<AppUserManageVo> findUserInfo(@PathVariable(value = "id") Integer userId) {
AppUserManageVo appUserManageVo = baseBiz.findUserInfoById(userId);
return ObjectRestResponse.succ(appUserManageVo);
}
/**
* 查询一条
*
* @param id
* @return
*/
@GetMapping("/findOneById/{id}")
public ObjectRestResponse<AppUserVo> findOneById(@PathVariable Integer id){
public ObjectRestResponse<AppUserVo> findOneById(@PathVariable Integer id) {
return ObjectRestResponse.succ(baseBiz.findOneById(id));
}
/**
* 保存
*
* @param appUserVo
* @return
*/
@PostMapping("/save")
public ObjectRestResponse save(@RequestBody AppUserVo appUserVo){
public ObjectRestResponse save(@RequestBody AppUserVo appUserVo) {
baseBiz.save(appUserVo);
return ObjectRestResponse.succ();
}
/**
* 禁用
*
* @param appUserId
* @return
*/
@PutMapping("/disable/{appUserId}")
public ObjectRestResponse disable(@PathVariable("appUserId") Integer appUserId){
public ObjectRestResponse disable(@PathVariable("appUserId") Integer appUserId) {
AppUserLogin appUserLogin = new AppUserLogin();
appUserLogin.setStatus(Status.FORBIDDEN);
appUserLogin.setId(appUserId);
......@@ -113,11 +129,12 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
/**
* 取消禁用
*
* @param appUserId
* @return
*/
@PutMapping("/available/{appUserId}")
public ObjectRestResponse available(@PathVariable("appUserId") Integer appUserId){
public ObjectRestResponse available(@PathVariable("appUserId") Integer appUserId) {
AppUserLogin appUserLogin = new AppUserLogin();
appUserLogin.setStatus(Status.AVAILABLE);
appUserLogin.setId(appUserId);
......@@ -127,19 +144,27 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
/**
* 删除用户
*
* @param id
* @return
*/
@DeleteMapping("/deleteById/{id}")
public ObjectRestResponse deleteById(@PathVariable Integer id){
public ObjectRestResponse deleteById(@PathVariable Integer id) {
appUserLoginBiz.deleteAppUserById(id);
return ObjectRestResponse.succ();
}
@PutMapping("/user_position")
public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id,@RequestParam("positionId") Integer positionId){
appUserDetailBiz.updateUserPositionByUserId(id,positionId);
return ObjectRestResponse.succ();
public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id, @RequestParam("positionId") Integer positionId, HttpServletRequest request) {
try {
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 {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
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) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
......@@ -138,7 +138,8 @@ public class AppUserPositionController {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
Integer operatorId = Integer.valueOf(infoFromToken.getId());
return ObjectRestResponse.succ(appUserPositionTempBiz.andAddUserPositionChangeRecord(appUserPositionTempDTO, operatorId));
appUserPositionTempBiz.andAddUserPositionChangeRecord(appUserPositionTempDTO, operatorId);
return ObjectRestResponse.succ();
} catch (Exception e) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
......
......@@ -89,12 +89,13 @@ public class AppUserRest {
@RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@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);
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 {
@RequestParam(value="unionid",defaultValue="")String unionid,
@RequestParam(value="type",defaultValue="0")Integer type,
@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)){
headimgurl=SystemConfig.USER_HEADER_URL_DEFAULT;
......@@ -130,7 +132,7 @@ public class AppUserRest {
if(StringUtils.isBlank(nickname)){
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 {
*/
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
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);
String activityCode = null;
// 判断参数和验证码
......@@ -333,6 +333,7 @@ public class AppPermissionService {
}
//生成邀请码 长度改为8 不然重复率太高
rsUserDetail.setCode(ReferralCodeUtil.encode(userid));
rsUserDetail.setChannel(channel);
appUserDetailBiz.insertSelective(rsUserDetail);
log.info("注册:新增用户详情: " + userid+"---time===="+System.currentTimeMillis()/1000L);
/* //绑定上下线关系
......@@ -556,7 +557,7 @@ public class AppPermissionService {
*/
@Transactional
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)) {
return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空");
......@@ -614,6 +615,7 @@ public class AppPermissionService {
userDetail.setUpdatetime(now);
userDetail.setIsdel(0);
userDetail.setCrtHost(getIp());
userDetail.setChannel(channel);
//setCreateIPInfo(userDetail);
appUserDetailBiz.insertSelective(userDetail);
......@@ -647,7 +649,7 @@ public class AppPermissionService {
}
} else if (type == 2) { // 新增
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.EXIST_CODE) {
return JsonResultUtil.createFailedResult(ResultCode.EXIST_CODE, "用户已存在");
......
......@@ -205,6 +205,7 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper, Act
}
}
} else {
// 获取锁失败
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 @@
and cst.tag_id=#{type}
</if>
<if test="addrProvince != null">
and cs.`province`=#{proviceCode}
and cs.`province`=#{addrProvince}
</if>
<if test="addrCity != null">
and cs.`city`=#{cityCode}
and cs.`city`=#{addrCity}
</if>
<if test="name!=null and name!=''">
and cs.`name` like concat('%',#{name},'%')
</if>
<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>
GROUP BY cs.id
order by cs.hot DESC,cs.crt_time DESC
......
......@@ -96,7 +96,7 @@ public enum StatisticsStatusEnum {
x.getPayWay() == null ? NO_PAY_WAY : x.getPayWay()
, x.getHasPay()));
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;
}
......
......@@ -154,6 +154,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
dataCell.setCellStyle(cellStyle);
String sign = signs.get(cellIndex - 1);
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()) {
continue;
}
......
......@@ -30,7 +30,7 @@
</resultMap>
<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_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">
......@@ -60,7 +60,7 @@
</select>
<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_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">
......@@ -90,7 +90,7 @@
</select>
<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_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">
......
......@@ -32,7 +32,7 @@
</resultMap>
<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">
and `has_pay`=#{orderState}
</if>
......@@ -61,7 +61,7 @@
</select>
<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">
and `has_pay`=#{orderState}
</if>
......@@ -90,7 +90,7 @@
</select>
<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">
and `has_pay`=#{orderState}
</if>
......
......@@ -19,7 +19,7 @@
<result property="crtTime" column="crt_time"/>
</resultMap>
<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">
and `has_pay`=#{orderState}
</if>
......@@ -47,7 +47,7 @@
</select>
<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">
and `has_pay`=#{orderState}
</if>
......@@ -75,7 +75,7 @@
</select>
<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">
and `has_pay`=#{orderState}
</if>
......
......@@ -24,7 +24,7 @@
</resultMap>
<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">
and `has_pay`=#{orderState}
</if>
......@@ -52,7 +52,7 @@
</select>
<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">
and `has_pay`=#{orderState}
</if>
......@@ -80,7 +80,7 @@
</select>
<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">
and `has_pay`=#{orderState}
</if>
......
......@@ -127,14 +127,13 @@ public class ServiceTest {
public void testOrderReceivedStatisticsJobHandler(){
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);
/* orderReceivedStatisticsJobHandler.execute("2019-11-29");*/
LocalDate startLocalDate = LocalDate.of(2019, 11, 30);
LocalDate endLocalDate = LocalDate.of(2019,12,19);
// orderReceivedStatisticsJobHandler.execute("2019-10-08");
LocalDate startLocalDate = LocalDate.of(2019, 10, 01);
LocalDate endLocalDate = LocalDate.of(2019,12,20);
while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1);
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