Commit 82da0de2 by chongli

项目相关接口开发

parent cdc59999
Showing with 2072 additions and 78 deletions
...@@ -146,6 +146,21 @@ ...@@ -146,6 +146,21 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId> <artifactId>commons-pool2</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>api</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
</dependency>
</dependencies> </dependencies>
......
...@@ -9,6 +9,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur ...@@ -9,6 +9,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.MessageDigestPasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
...@@ -71,7 +72,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -71,7 +72,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception { protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); auth.userDetailsService(userDetailsService).passwordEncoder(new MessageDigestPasswordEncoder("MD5"));
} }
} }
...@@ -11,6 +11,15 @@ import java.util.Map; ...@@ -11,6 +11,15 @@ import java.util.Map;
public abstract class AbstractController<T> { public abstract class AbstractController<T> {
@GetMapping("/{id}")
@ApiOperation(value = "根据id获取")
public Response<Object> get(@PathVariable Long id) {
Response<Object> response = new Response<Object>(ResponseStatusEnum.SUCCESS,null);
response.setStatusEnum(ResponseStatusEnum.SUCCESS);
response.setData(this.getAbstractDao().getById(id));
return response;
}
@PostMapping @PostMapping
@ApiOperation(value = "保存") @ApiOperation(value = "保存")
public Response<String> save(@RequestBody T entity) { public Response<String> save(@RequestBody T entity) {
...@@ -20,15 +29,6 @@ public abstract class AbstractController<T> { ...@@ -20,15 +29,6 @@ public abstract class AbstractController<T> {
return response; return response;
} }
@GetMapping("/{id}")
@ApiOperation(value = "根据id获取")
public Response<T> get(@PathVariable Long id) {
Response<T> response = new Response<T>(ResponseStatusEnum.SUCCESS,null);
response.setStatusEnum(ResponseStatusEnum.SUCCESS);
response.setData(this.getAbstractDao().getById(id));
return response;
}
@GetMapping("uid/{uid}") @GetMapping("uid/{uid}")
@ApiOperation(value = "根据UID获取") @ApiOperation(value = "根据UID获取")
public Response<T> getUserCommuneRelation(@PathVariable String uid) { public Response<T> getUserCommuneRelation(@PathVariable String uid) {
......
package com.boot.security.server.controller;
import com.boot.security.server.dao.AdmUsersDao;
import com.boot.security.server.dto.Response;
import com.boot.security.server.dto.ResponseStatusEnum;
import com.boot.security.server.utils.UserUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.boot.security.server.model.AdmUsers;
@RestController
@RequestMapping("/admUsers")
public class AdmUserController {
@Autowired
private AdmUsersDao admUsersDao;
@GetMapping("/me")
public Response<AdmUsers> me() {
Response<AdmUsers> response = new Response<AdmUsers>(ResponseStatusEnum.SUCCESS,null);
Long admId = UserUtil.getLoginUser().getId();
response.setData(admUsersDao.getById(admId));
return response;
}
}
package com.boot.security.server.controller; package com.boot.security.server.controller;
import com.boot.security.server.dao.AbstractDao; import com.boot.security.server.dao.*;
import com.boot.security.server.dto.EntityImageBean;
import com.boot.security.server.dto.Response;
import com.boot.security.server.dto.ResponseStatusEnum;
import com.boot.security.server.model.CommuneAdm;
import com.boot.security.server.model.Entityimage;
import com.boot.security.server.model.UsrCommuneExt;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.boot.security.server.model.CommunicationRecord; import com.boot.security.server.model.CommunicationRecord;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("/communicationRecords") @RequestMapping("/communicationRecords")
public class CommunicationRecordController extends AbstractController<CommunicationRecord> { public class CommunicationRecordController extends AbstractController<CommunicationRecord> {
@Autowired @Autowired
private AbstractDao<CommunicationRecord> communicationRecordDao; private CommunicationRecordDao communicationRecordDao;
@Autowired
private UsrCommuneExtDao usrCommuneExtDao;
@Autowired
private CommuneAdmDao communeAdmDao;
@Autowired
private EntityimageDao entityimageDao;
public AbstractDao<CommunicationRecord> getAbstractDao() { public AbstractDao<CommunicationRecord> getAbstractDao() {
return communicationRecordDao; return communicationRecordDao;
} }
public Response<String> save(@RequestBody CommunicationRecord entity) {
Response<String> response = new Response<String>(ResponseStatusEnum.SUCCESS,null);
communicationRecordDao.save(entity);
//查社员表
UsrCommuneExt usrCommuneExt = usrCommuneExtDao.getByUid(entity.getUid());
//查社员管理表id
CommuneAdm communeAdm = communeAdmDao.getCommuneExtId(usrCommuneExt.getId());
//更新交流时间
communeAdm.setLastCommunicationTime(entity.getCommunicationTime());
communeAdmDao.update(communeAdm);
response.setData("success");
return response;
}
@GetMapping("attach/{attachIds}")
@ApiOperation(value = "根据UID获取")
public Response<List<Entityimage>> getAttachs(@PathVariable String attachIds) {
Response<List<Entityimage>> response = new Response<List<Entityimage>>(ResponseStatusEnum.SUCCESS,null);
String[] ids = attachIds.split(",");
List<Entityimage> list = new ArrayList<Entityimage>();
for(String id:ids){
Entityimage entityimage= entityimageDao.getById(Long.parseLong(id));
if(entityimage!=null){
list.add(entityimage);
}
}
response.setData(list);
return response;
}
} }
\ No newline at end of file
package com.boot.security.server.controller; package com.boot.security.server.controller;
import java.io.IOException; import java.io.*;
import java.util.Date;
import java.util.List; import java.util.List;
import com.boot.security.server.dao.EntityimageDao;
import com.boot.security.server.dto.*;
import com.boot.security.server.model.Entityimage;
import com.boot.security.server.service.impl.ImageService;
import com.squareup.okhttp.ResponseBody;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
...@@ -15,19 +22,19 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -15,19 +22,19 @@ import org.springframework.web.multipart.MultipartFile;
import com.boot.security.server.annotation.LogAnnotation; import com.boot.security.server.annotation.LogAnnotation;
import com.boot.security.server.dao.FileInfoDao; import com.boot.security.server.dao.FileInfoDao;
import com.boot.security.server.dto.LayuiFile;
import com.boot.security.server.dto.LayuiFile.LayuiFileData; import com.boot.security.server.dto.LayuiFile.LayuiFileData;
import com.boot.security.server.model.FileInfo; import com.boot.security.server.model.FileInfo;
import com.boot.security.server.page.table.PageTableHandler; import com.boot.security.server.page.table.PageTableHandler;
import com.boot.security.server.page.table.PageTableHandler.CountHandler; import com.boot.security.server.page.table.PageTableHandler.CountHandler;
import com.boot.security.server.page.table.PageTableHandler.ListHandler; import com.boot.security.server.page.table.PageTableHandler.ListHandler;
import com.boot.security.server.page.table.PageTableRequest; import com.boot.security.server.page.table.PageTableRequest;
import com.boot.security.server.dto.PageTableResponse;
import com.boot.security.server.service.FileService; import com.boot.security.server.service.FileService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletResponse;
@Api(tags = "文件") @Api(tags = "文件")
@RestController @RestController
@RequestMapping("/files") @RequestMapping("/files")
...@@ -38,11 +45,72 @@ public class FileController { ...@@ -38,11 +45,72 @@ public class FileController {
@Autowired @Autowired
private FileInfoDao fileInfoDao; private FileInfoDao fileInfoDao;
@Autowired
private ImageService imageService = null;
@Autowired
private EntityimageDao entityimageDao;
@LogAnnotation @LogAnnotation
@PostMapping @PostMapping
@ApiOperation(value = "文件上传") @ApiOperation(value = "文件上传")
public FileInfo uploadFile(MultipartFile file) throws IOException { public Response<EntityImageBean> uploadFile(MultipartFile file) throws IOException {
return fileService.save(file); Response<EntityImageBean> response = new Response<EntityImageBean>(ResponseStatusEnum.SUCCESS,null);
EntityImageBean entityImageBean = imageService.upload(file.getBytes(),this.reFileName(file.getOriginalFilename()));
Entityimage entityImage = new Entityimage();
BeanUtils.copyProperties(entityImageBean,entityImage);
entityimageDao.save(entityImage);
entityImageBean.setId(entityImage.getId());
response.setData(entityImageBean);
return response;
}
private String reFileName(String sourceFileName){
String fName = "";
String suffix = "";
if(sourceFileName.indexOf(".")>=0){
int indexdot = sourceFileName.indexOf(".");
suffix = sourceFileName.substring(indexdot);
fName = sourceFileName.substring(0,sourceFileName.lastIndexOf("."));
Date now = new Date();
fName = fName + "_" +now.getTime();
fName = fName + suffix;
return fName;
}
return "";
}
@GetMapping("/{id}")
public void downLoad(@PathVariable Long id, HttpServletResponse response) throws Exception {
Entityimage entityimage = entityimageDao.getById(id);
String fileName = entityimage.getHash()+"."+entityimage.getExt();
response.setContentType("application/x-msdownload");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
ResponseBody responseBody = imageService.download("http://img.iwanoutdoor.com/"+fileName);
InputStream inputStream = responseBody.byteStream();
int len=0;
byte[] buff = new byte[1024];
OutputStream out = response.getOutputStream();
try {
while ((len = inputStream.read(buff)) != -1) {
out.write(buff, 0, len);
}
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}finally {
if(inputStream!=null) inputStream.close();
if(out!=null) out.close();
}
} }
/** /**
......
...@@ -2,6 +2,7 @@ package com.boot.security.server.controller; ...@@ -2,6 +2,7 @@ package com.boot.security.server.controller;
import java.util.List; import java.util.List;
import com.boot.security.server.model.AdmUsers;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
...@@ -117,7 +118,7 @@ public class NoticeController { ...@@ -117,7 +118,7 @@ public class NoticeController {
@ApiOperation(value = "未读公告数") @ApiOperation(value = "未读公告数")
@GetMapping("/count-unread") @GetMapping("/count-unread")
public Integer countUnread() { public Integer countUnread() {
SysUser user = UserUtil.getLoginUser(); AdmUsers user = UserUtil.getLoginUser();
return noticeDao.countUnread(user.getId()); return noticeDao.countUnread(user.getId());
} }
......
package com.boot.security.server.controller; package com.boot.security.server.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.boot.security.server.dao.AbstractDao; import com.boot.security.server.dao.AbstractDao;
import com.boot.security.server.dto.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -15,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -15,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController;
import com.boot.security.server.page.table.PageTableRequest; import com.boot.security.server.page.table.PageTableRequest;
import com.boot.security.server.page.table.PageTableHandler; import com.boot.security.server.page.table.PageTableHandler;
import com.boot.security.server.dto.PageTableResponse;
import com.boot.security.server.page.table.PageTableHandler.CountHandler; import com.boot.security.server.page.table.PageTableHandler.CountHandler;
import com.boot.security.server.page.table.PageTableHandler.ListHandler; import com.boot.security.server.page.table.PageTableHandler.ListHandler;
import com.boot.security.server.dao.OrderDao; import com.boot.security.server.dao.OrderDao;
...@@ -34,4 +36,34 @@ public class OrderController extends AbstractController{ ...@@ -34,4 +36,34 @@ public class OrderController extends AbstractController{
protected AbstractDao getAbstractDao() { protected AbstractDao getAbstractDao() {
return orderDao; return orderDao;
} }
@GetMapping
@ApiOperation(value = "列表")
public Response<PageData> list(PageTableRequest request) {
Response<PageData> response = new Response<PageData>(ResponseStatusEnum.SUCCESS,null);
int count = this.getAbstractDao().count(request.getParams());
List<Order> list = orderDao.list(request.getParams(), (request.getCurrent()-1)*request.getPageSize(),request.getPageSize());
List<OrderListBean> listBeans = new ArrayList<OrderListBean>();
for(Order order:list){
OrderListBean orderListBean = new OrderListBean();
BeanUtils.copyProperties(order,orderListBean);
OrderStatusEnum orderStatusEnum = OrderStatusEnum.getOrderStatus(
orderListBean.getOrderType(), orderListBean.getPayMode(),
orderListBean.getConfirmType(), orderListBean.getProcessStatus(),
false);
orderListBean.setOrderStatusDesc(orderStatusEnum.getShowStatusName());
listBeans.add(orderListBean);
}
Pagination pagination = new Pagination(count,request.getCurrent(), request.getPageSize());
PageData<OrderListBean> pageData = new PageData<OrderListBean>(listBeans,pagination);
response.setData(pageData);
return response;
}
} }
...@@ -2,6 +2,7 @@ package com.boot.security.server.controller; ...@@ -2,6 +2,7 @@ package com.boot.security.server.controller;
import java.util.List; import java.util.List;
import com.boot.security.server.model.AdmUsers;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -74,7 +75,7 @@ public class UserController { ...@@ -74,7 +75,7 @@ public class UserController {
@PutMapping(params = "headImgUrl") @PutMapping(params = "headImgUrl")
@ApiOperation(value = "修改头像") @ApiOperation(value = "修改头像")
public void updateHeadImgUrl(String headImgUrl) { public void updateHeadImgUrl(String headImgUrl) {
SysUser user = UserUtil.getLoginUser(); AdmUsers user = UserUtil.getLoginUser();
UserDto userDto = new UserDto(); UserDto userDto = new UserDto();
BeanUtils.copyProperties(user, userDto); BeanUtils.copyProperties(user, userDto);
userDto.setHeadImgUrl(headImgUrl); userDto.setHeadImgUrl(headImgUrl);
...@@ -113,7 +114,7 @@ public class UserController { ...@@ -113,7 +114,7 @@ public class UserController {
@ApiOperation(value = "当前登录用户") @ApiOperation(value = "当前登录用户")
@GetMapping("/current") @GetMapping("/current")
public SysUser currentUser() { public AdmUsers currentUser() {
return UserUtil.getLoginUser(); return UserUtil.getLoginUser();
} }
......
package com.boot.security.server.controller; package com.boot.security.server.controller;
import java.util.List;
import com.boot.security.server.dao.AbstractDao; import com.boot.security.server.dao.AbstractDao;
import com.boot.security.server.dto.*;
import com.boot.security.server.utils.UserUtil;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.boot.security.server.page.table.PageTableRequest; import com.boot.security.server.page.table.PageTableRequest;
import com.boot.security.server.page.table.PageTableHandler;
import com.boot.security.server.dto.PageTableResponse;
import com.boot.security.server.page.table.PageTableHandler.CountHandler;
import com.boot.security.server.page.table.PageTableHandler.ListHandler;
import com.boot.security.server.dao.UsrCommuneExtDao; import com.boot.security.server.dao.UsrCommuneExtDao;
import com.boot.security.server.model.UsrCommuneExt; import com.boot.security.server.model.UsrCommuneExt;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController @RestController
@RequestMapping("/usrCommuneExts") @RequestMapping("/usrCommuneExts")
public class UsrCommuneExtController extends AbstractController<UsrCommuneExt>{ public class UsrCommuneExtController extends AbstractController<UsrCommuneExt>{
...@@ -34,4 +28,113 @@ public class UsrCommuneExtController extends AbstractController<UsrCommuneExt>{ ...@@ -34,4 +28,113 @@ public class UsrCommuneExtController extends AbstractController<UsrCommuneExt>{
protected AbstractDao<UsrCommuneExt> getAbstractDao() { protected AbstractDao<UsrCommuneExt> getAbstractDao() {
return usrCommuneExtDao; return usrCommuneExtDao;
} }
@Override
public Response<Object> get(@PathVariable Long id) {
Response<Object> response = new Response<Object>(ResponseStatusEnum.SUCCESS,null);
response.setStatusEnum(ResponseStatusEnum.SUCCESS);
response.setData(usrCommuneExtDao.getBeanById(id));
return response;
}
@Override
public Response<PageData> list(PageTableRequest request){
Response<PageData> response = new Response<PageData>(ResponseStatusEnum.SUCCESS,null);
request.getParams().put("admUserId",UserUtil.getLoginUser().getId());
Object communeEndTimeStart = request.getParams().get("communeEndTimeStart");
Object communeEndTimeEnd = request.getParams().get("communeEndTimeEnd");
try {
if(communeEndTimeStart!=null){
request.getParams().put("communeAgainTimeStart",this.dateStringAddYears((String)communeEndTimeStart,-1));
}
if(communeEndTimeEnd!=null){
request.getParams().put("communeAgainTimeEnd",this.dateStringAddYears((String)communeEndTimeEnd,-1));
}
int count =usrCommuneExtDao.countBean(request.getParams());
List<UsrCommuneExtBean> list = usrCommuneExtDao.listBean(request.getParams(), (request.getCurrent()-1)*request.getPageSize(),request.getPageSize());
Pagination pagination = new Pagination(count,request.getCurrent(), request.getPageSize());
PageData<UsrCommuneExtBean> pageData = new PageData<UsrCommuneExtBean>(list,pagination);
response.setData(pageData);
return response;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
private String dateStringAddYears(String communeEndTimeStart,int years) throws Exception{
Date date = DateUtils.addYears(DateUtils.parseDate(communeEndTimeStart, "yyyy-MM-dd hh:mm:ss"), years);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = sdf.format(date);
return format;
}
//当天沟通 7天未沟通 30天未沟通 90天未沟通 从未沟通
@GetMapping("/lastCommunicationTime")
@ApiOperation(value = "根据id获取")
public Response<Map<String,Integer>> getLastCommunicationTime() {
Response<Map<String,Integer>> response = new Response<Map<String,Integer>>(ResponseStatusEnum.SUCCESS,null);
response.setStatusEnum(ResponseStatusEnum.SUCCESS);
Date todayStart = DateUtils.truncate(new Date(), Calendar.DATE);// 过滤时分秒
Date todayEnd =DateUtils.addSeconds(todayStart,86399);// 过滤时分秒
Map<String, Object> params_one = new HashMap<String, Object>();
params_one.put("admUserId",UserUtil.getLoginUser().getId());
params_one.put("lastCommunicationTimeStart",todayStart);
params_one.put("lastCommunicationTimeEnd",todayEnd);
int one =usrCommuneExtDao.countBean(params_one);//当天沟通
Map<String, Object> params_seven_non = new HashMap<String, Object>();
params_seven_non.put("admUserId",UserUtil.getLoginUser().getId());
params_seven_non.put("lastCommunicationTimeEnd",DateUtils.addDays(todayEnd,-7));
int seven_non =usrCommuneExtDao.countBean(params_seven_non);//一周未沟通
Map<String, Object> params_month_non = new HashMap<String, Object>();
params_month_non.put("admUserId",UserUtil.getLoginUser().getId());
params_month_non.put("lastCommunicationTimeEnd",DateUtils.addDays(todayEnd,-30));
int month_non =usrCommuneExtDao.countBean(params_seven_non);//一月未沟通
Map<String, Object> params_three_month_non = new HashMap<String, Object>();
params_three_month_non.put("admUserId",UserUtil.getLoginUser().getId());
params_three_month_non.put("lastCommunicationTimeEnd",DateUtils.addDays(todayEnd,-90));
int three_month_non =usrCommuneExtDao.countBean(params_three_month_non);//一月未沟通
Map<String, Object> params_all_non = new HashMap<String, Object>();
params_all_non.put("admUserId",UserUtil.getLoginUser().getId());
params_all_non.put("nonCommunication","nonCommunication");
int all_non =usrCommuneExtDao.countBean(params_all_non);//从未沟通
////当天沟通 一周未沟通 30天未沟通 90天未沟通 从未沟通
Map<String,Integer> counts = new HashMap<String,Integer>();
counts.put("one",one);
counts.put("seven_non",seven_non);
counts.put("month_non",month_non);
counts.put("three_month_non",three_month_non);
counts.put("all_non",all_non);
response.setData(counts);
return response;
}
public static void main(String[] args) {
System.out.println(DateUtils.ceiling(new Date(), Calendar.HOUR));
Date dateStart = DateUtils.truncate(new Date(), Calendar.DATE);// 过滤时分秒
Date dateEnd = DateUtils.addSeconds(dateStart,86399);// 过滤时分秒
printFormatDate(dateStart);
printFormatDate(dateEnd);
}
public static void printFormatDate(Date d) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(df.format(d));
}
} }
package com.boot.security.server.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.boot.security.server.model.AdmUsers;
@Mapper
public interface AdmUsersDao extends AbstractDao<AdmUsers>{
@Select("select * from adm_users t where t.id = #{id}")
AdmUsers getById(Long id);
@Delete("delete from adm_users where id = #{id}")
int delete(Long id);
int update(AdmUsers admUsers);
@Select("select * from adm_users t where t.username = #{username}")
AdmUsers getUser(String username);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into adm_users(username, nickName, password, enable, DataChange_LastTime) values(#{username}, #{nickName}, #{password}, #{enable}, #{DataChangeLastTime})")
int save(AdmUsers admUsers);
}
package com.boot.security.server.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.boot.security.server.model.CommuneAdm;
@Mapper
public interface CommuneAdmDao {
@Select("select * from usr_commune_adm t where t.id = #{id}")
CommuneAdm getById(Long id);
@Select("select * from usr_commune_adm t where t.communeExtId = #{communeExtId}")
CommuneAdm getCommuneExtId(Long communeExtId);
@Delete("delete from usr_commune_adm where id = #{id}")
int delete(Long id);
int update(CommuneAdm communeAdm);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into usr_commune_adm(communeExtId, uid, admUserId, bindTime, wechatRemark, wechatRemarkTime, labels, unbindFlag, lastCommunicationTime) values(#{communeExtId}, #{uid}, #{admUserId}, #{bindTime}, #{wechatRemark}, #{wechatRemarkTime}, #{labels}, #{unbindFlag}, #{lastCommunicationTime})")
int save(CommuneAdm communeAdm);
int count(@Param("params") Map<String, Object> params);
List<CommuneAdm> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
...@@ -24,10 +24,12 @@ public interface CommunicationRecordDao extends AbstractDao<CommunicationRecord ...@@ -24,10 +24,12 @@ public interface CommunicationRecordDao extends AbstractDao<CommunicationRecord
int update(CommunicationRecord communicationRecord); int update(CommunicationRecord communicationRecord);
@Options(useGeneratedKeys = true, keyProperty = "id") @Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into arc_communicationrecord(uid, description, attached) values(#{uid}, #{description}, #{attached})") @Insert("insert into arc_communicationrecord(uid, description, attachIds,communicationTime) values(#{uid}, #{description}, #{attachIds}, #{communicationTime})")
int save(CommunicationRecord communicationRecord); int save(CommunicationRecord communicationRecord);
int count(@Param("params") Map<String, Object> params); int count(@Param("params") Map<String, Object> params);
List<CommunicationRecord> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit); List<CommunicationRecord> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
} }
package com.boot.security.server.dao;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* Created by pat on 14-5-21.
*
* @author: l_cheng@ctrip.com
* @date: 2014-05-21
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EntityImageBean implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = -8885326833649081795L;
/**
* id
*/
private Integer id;
/**
* 实体类型
*/
private String entityType;
/**
* 实体id
*/
private Integer entityId;
/**
* 标题
*/
private String title;
private String path;
private String hash;
private String ext;
/**
* 排序
*/
private Integer sort;
/**
* 修改时间
*/
private Date dataChangeLastTime;
/**
* 创建时间
*/
private Date createdTime;
private String url;
/**
* 扩展标记
*/
private String mark;
public EntityImageBean(Integer id, String entityType, Integer entityId, Integer imageId, String title, String path, String hash, String ext, Integer sort) {
this.id = id;
this.entityType = entityType;
this.entityId = entityId;
this.title = title;
this.path = path;
this.hash = hash;
this.ext = ext;
this.sort = sort;
}
public EntityImageBean() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEntityType() {
return entityType;
}
public void setEntityType(String entityType) {
this.entityType = entityType;
}
public Integer getEntityId() {
return entityId;
}
public void setEntityId(Integer entityId) {
this.entityId = entityId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getDataChangeLastTime() {
return dataChangeLastTime;
}
public void setDataChangeLastTime(Date dataChangeLastTime) {
this.dataChangeLastTime = dataChangeLastTime;
}
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public String getPath() {
return path;
}
public String getHash() {
return hash;
}
public String getExt() {
return ext;
}
public void setPath(String path) {
this.path = path;
}
public void setHash(String hash) {
this.hash = hash;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
/* public String getImagePath() {
if (null == this.path || null == this.hash || null == this.ext){
return "";
}
return String.format("%s/%s.%s", this.path, this.hash, this.ext);
}*/
/* public String getImagePath(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext){
return "";
}
return String.format("%s/%s_%d_%d.%s", this.path, this.hash, width, height, this.ext);
}*/
public String getImagePath() {
if (null == this.path || null == this.hash || null == this.ext){
return "";
}
return String.format("%s%s.%s", this.path, this.hash, this.ext);
}
public String getImagePath(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext) {
return "";
}
return String.format("%s%s.%s?imageView2/1/w/%d/h/%d", this.path, this.hash,this.ext,width,height);
}
public String getImagePathForJpg(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext) {
return "";
}
if (ext.endsWith("jpg") || ext.endsWith("JPG")) {
return String.format("%s%s.%s?imageView2/1/w/%d/h/%d", this.path, this.hash, this.ext, width, height);
} else {
return String.format("%s%s.%s?imageView2/1/format/jpg/w/%d/h/%d", this.path, this.hash, this.ext, width, height);
}
}
public String getDynamicImagePath(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext) {
return "";
}
return String.format("%s%s.%s?imageView2/1/w/%d/h/%d", this.path, this.hash,this.ext,width,height);
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
@Override
public String toString() {
return "EntityImageBean [id=" + id + ", entityType=" + entityType
+ ", entityId=" + entityId + ", title=" + title + ", path="
+ path + ", hash=" + hash + ", ext=" + ext + ", sort=" + sort
+ ", dataChangeLastTime=" + dataChangeLastTime
+ ", createdTime=" + createdTime + ", url=" + url + ", mark="
+ mark + "]";
}
}
package com.boot.security.server.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.boot.security.server.model.Entityimage;
@Mapper
public interface EntityimageDao {
@Select("SELECT id,ext,hash from bsc_entityimage t where t.id = #{id}")
Entityimage getById(Long id);
@Delete("delete from bsc_entityimage where id = #{id}")
int delete(Long id);
int update(Entityimage entityimage);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into bsc_entityimage(id, EntityID, EntityType, ext, hash, path, Sort, title) values(#{id}, #{EntityID}, #{EntityType}, #{ext}, #{hash}, #{path}, #{Sort}, #{title})")
int save(Entityimage entityimage);
int count(@Param("params") Map<String, Object> params);
List<Entityimage> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
package com.boot.security.server.dao; package com.boot.security.server.dao;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.boot.security.server.dto.UsrCommuneExtBean;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -16,6 +18,9 @@ public interface UsrCommuneExtDao extends AbstractDao<UsrCommuneExt> { ...@@ -16,6 +18,9 @@ public interface UsrCommuneExtDao extends AbstractDao<UsrCommuneExt> {
@Select("select * from usr_commune_ext t where t.id = #{id}") @Select("select * from usr_commune_ext t where t.id = #{id}")
UsrCommuneExt getById(Long id); UsrCommuneExt getById(Long id);
@Select("select * from usr_commune_ext t where t.uid = #{uid}")
UsrCommuneExt getByUid(String uid);
@Delete("delete from usr_commune_ext where id = #{id}") @Delete("delete from usr_commune_ext where id = #{id}")
int delete(Long id); int delete(Long id);
...@@ -28,4 +33,12 @@ public interface UsrCommuneExtDao extends AbstractDao<UsrCommuneExt> { ...@@ -28,4 +33,12 @@ public interface UsrCommuneExtDao extends AbstractDao<UsrCommuneExt> {
int count(@Param("params") Map<String, Object> params); int count(@Param("params") Map<String, Object> params);
List<UsrCommuneExt> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit); List<UsrCommuneExt> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
UsrCommuneExtBean getBeanById(@Param("id") Long id);
int countBean(@Param("params") Map<String, Object> params);
List<UsrCommuneExtBean> listBean(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
} }
package com.boot.security.server.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* Created by pat on 14-5-21.
*
* @author: l_cheng@ctrip.com
* @date: 2014-05-21
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EntityImageBean implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = -8885326833649081795L;
/**
* id
*/
private Long id;
/**
* 实体类型
*/
private String entityType;
/**
* 实体id
*/
private Integer entityId;
/**
* 标题
*/
private String title;
private String path;
private String hash;
private String ext;
/**
* 排序
*/
private Integer sort;
/**
* 修改时间
*/
private Date dataChangeLastTime;
/**
* 创建时间
*/
private Date createdTime;
private String url;
/**
* 扩展标记
*/
private String mark;
public EntityImageBean(Long id, String entityType, Integer entityId, Integer imageId, String title, String path, String hash, String ext, Integer sort) {
this.id = id;
this.entityType = entityType;
this.entityId = entityId;
this.title = title;
this.path = path;
this.hash = hash;
this.ext = ext;
this.sort = sort;
}
public EntityImageBean() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEntityType() {
return entityType;
}
public void setEntityType(String entityType) {
this.entityType = entityType;
}
public Integer getEntityId() {
return entityId;
}
public void setEntityId(Integer entityId) {
this.entityId = entityId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getDataChangeLastTime() {
return dataChangeLastTime;
}
public void setDataChangeLastTime(Date dataChangeLastTime) {
this.dataChangeLastTime = dataChangeLastTime;
}
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public String getPath() {
return path;
}
public String getHash() {
return hash;
}
public String getExt() {
return ext;
}
public void setPath(String path) {
this.path = path;
}
public void setHash(String hash) {
this.hash = hash;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
/* public String getImagePath() {
if (null == this.path || null == this.hash || null == this.ext){
return "";
}
return String.format("%s/%s.%s", this.path, this.hash, this.ext);
}*/
/* public String getImagePath(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext){
return "";
}
return String.format("%s/%s_%d_%d.%s", this.path, this.hash, width, height, this.ext);
}*/
public String getImagePath() {
if (null == this.path || null == this.hash || null == this.ext){
return "";
}
return String.format("%s%s.%s", this.path, this.hash, this.ext);
}
public String getImagePath(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext) {
return "";
}
return String.format("%s%s.%s?imageView2/1/w/%d/h/%d", this.path, this.hash,this.ext,width,height);
}
public String getImagePathForJpg(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext) {
return "";
}
if (ext.endsWith("jpg") || ext.endsWith("JPG")) {
return String.format("%s%s.%s?imageView2/1/w/%d/h/%d", this.path, this.hash, this.ext, width, height);
} else {
return String.format("%s%s.%s?imageView2/1/format/jpg/w/%d/h/%d", this.path, this.hash, this.ext, width, height);
}
}
public String getDynamicImagePath(int width, int height) {
if (null == this.path || null == this.hash || null == this.ext) {
return "";
}
return String.format("%s%s.%s?imageView2/1/w/%d/h/%d", this.path, this.hash,this.ext,width,height);
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
@Override
public String toString() {
return "EntityImageBean [id=" + id + ", entityType=" + entityType
+ ", entityId=" + entityId + ", title=" + title + ", path="
+ path + ", hash=" + hash + ", ext=" + ext + ", sort=" + sort
+ ", dataChangeLastTime=" + dataChangeLastTime
+ ", createdTime=" + createdTime + ", url=" + url + ", mark="
+ mark + "]";
}
}
...@@ -4,16 +4,15 @@ import java.util.Collection; ...@@ -4,16 +4,15 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.boot.security.server.model.AdmUsers;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import com.boot.security.server.model.Permission; import com.boot.security.server.model.Permission;
import com.boot.security.server.model.SysUser;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
public class LoginUser extends SysUser implements UserDetails { public class LoginUser extends AdmUsers implements UserDetails {
private static final long serialVersionUID = -1379274258881257107L; private static final long serialVersionUID = -1379274258881257107L;
...@@ -62,7 +61,7 @@ public class LoginUser extends SysUser implements UserDetails { ...@@ -62,7 +61,7 @@ public class LoginUser extends SysUser implements UserDetails {
@JsonIgnore @JsonIgnore
@Override @Override
public boolean isAccountNonLocked() { public boolean isAccountNonLocked() {
return getStatus() != Status.LOCKED; return true;
} }
// 密码是否未过期 // 密码是否未过期
......
package com.boot.security.server.dto;
import com.boot.security.server.model.Order;
public class OrderListBean extends Order {
private String orderStatusDesc;
public String getOrderStatusDesc() {
return orderStatusDesc;
}
public void setOrderStatusDesc(String orderStatusDesc) {
this.orderStatusDesc = orderStatusDesc;
}
}
package com.boot.security.server.dto;
/**
* @author zgsong
* @version 1.0.0
*/
public enum OrderStatusBitEnum {
// 0--未操作
// 2^0=1 --确认产品
// 2^1=2--确认客户
// 2^2=4--扣款中
// 2^3=8--付款失败
// 2^4=16--已付款
// 2^5=32--取消中
// 2^6=64--已取消
// 2^7=128--退订中
// 2^8=256--退款中
// 2^9=512--退款失败
// 2^10=1024--已退款
// 2^11=2048--已退订
// 2^12=4096--成交部分退订
// 2^13=8192--成交全部退订
// 2^14=16384--担保转扣款中
// 2^15=32768--担保转扣款失败
// 2^16=65536--已担保转扣款
// 2^17=131072--预授权转扣款中
// 2^18=262144--预授权转扣款失败
// 2^19=524288--已预授权转扣款
// 2^20=1048576--解除预授权中
// 2^21=2097152--解除预授权失败
// 2^22=4194304 --已解除预授权
// 2^23=8388608 --确认打款
// 2^24=16777216 --发送发票
// 2^25=33554432 --待预授权处理
// 2^26=268435456 --成交
/**
* 未操作0
*/
UNOPERATION(0, "UNOPERATION", "未操作"),
/**
* 确认产品1
*/
CONFIRM_PRODUCT(1, "CONFIRM_PRODUCT", "确认产品"),
/**
* 确认客户2
*/
CONFIRM_CUSTOMER(2, "CONFIRM_CUSTOMER", "确认客户"),
/**
* 扣款中4
*/
DEDUCTING(4, "DEDUCTING", "扣款中"),
/**
* 扣款失败8
*/
DEDUCT_FAILED(8, "DEDUCT_FAILED", "扣款失败"),
/**
* 已扣款16
*/
DEDUCTED(16, "DEDUCTED", "已扣款"),
/**
* 取消中32
*/
CANCELING(32, "CANCELING", "取消中"),
/**
* 已取消64
*/
CANCELED(64, "CANCELED", "已取消"),
/**
* 退订中128
*/
UNSUBSCRIBING(128, "UNSUBSCRIBING", "退订中"),
/**
* 退款中256
*/
REFUNDING(256, "REFUNDING", "退款中"),
/**
* 退款失败512
*/
REFUND_FAILED(512, "REFUND_FAILED", "退款失败"),
/**
* 已退款1024
*/
REFUNDED(1024, "REFUNDED", "已退款"),
/**
* 已退订2048
*/
UNSUBSCRIBED(2048, "UNSUBSCRIBED", "已退订"),
/**
* 成交部分退订4096
*/
PART_UNSUBSCRIBED(4096, "PART_UNSUBSCRIBED", "成交部分退订"),
/**
* 成交全部退订8192
*/
ALL_UNSUBSCRIBED(8192, "ALL_UNSUBSCRIBED", "成交全部退订"),
/**
* 担保转扣款中16384
*/
GUARANTEE_TO_DEDUCTING(16384, "GUARANTEE_TO_DEDUCTING", "担保转扣款中"),
/**
* 担保转扣款失败 32768
*/
GUARANTEE_TO_DEDUCTION_FAILED(32768, "GUARANTEE_TO_DEDUCTION_FAILED", "担保转扣款失败"),
/**
* 已担保转扣款 65536
*/
GUARANTEE_TO_DEDUCTED(65536, "GUARANTEE_TO_DEDUCTED", "已担保转扣款"),
/**
* 预授权转扣款中131072
*/
PRE_AUTHORIZATION_DEDUCTING(131072, "PRE_AUTHORIZATION_DEDUCTING", "预授权转扣款中"),
/**
* 预授权转扣款失败262144
*/
PRE_AUTHORIZATION_DEDUCTION_FAILED(262144, "PRE_AUTHORIZATION_DEDUCTION_FAILED", "预授权转扣款失败"),
/**
* 已预授权转扣款524288
*/
PRE_AUTHORIZATION_DEDUCTED(524288, "PRE_AUTHORIZATION_DEDUCTED", "已预授权转扣款"),
/**
* 解除预授权中1048576
*/
UNFREEZE_PRE_AUTHORIZATING(1048576, "UNFREEZE_PRE_AUTHORIZATION", "解除预授权中"),
/**
* 解除预授权失败2097152
*/
UNFREEZE_PRE_AUTHORIZATE_FAILED(2097152, "UNFREEZE_PRE_AUTHORIZATE_FAILED", "解除预授权失败"),
/**
* 已解除预授权4194304
*/
UNFREEZE_PRE_AUTHORIZATED(4194304, "UNFREEZE_PRE_AUTHORIZATE_FAILED", "已解除预授权"),
/**
* 确认打款8388608
*/
CONFIRM_PAIED(8388608, "CONFIRM_PAIED", "确认打款"),
/**
* 确认发票16777216
*/
CONFIRM_INVOICE(16777216, "CONFIRM_INVOICE", "确认发票"),
/**
* 待预授权处理33554432
*/
WAIT_PREAUTH_HANDING(33554432, "WAIT_PREAUTH_HANDING", "待预授权处理"),
/**
* 成交268435456
*/
BARGAINED(268435456, "BARGAINED", "成交");
private int value;
private String name;
private String cname;
private OrderStatusBitEnum(int value, String name, String cname) {
this.value = value;
this.name = name;
this.cname = cname;
}
public static int getSumStatusValue() {
int value = 0;
for (OrderStatusBitEnum orderStatusBitEnum : OrderStatusBitEnum.values()) {
value = value + orderStatusBitEnum.getValue();
}
return value;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
public String getCname() {
return cname;
}
public void setValue(int value) {
this.value = value;
}
public void setName(String name) {
this.name = name;
}
public void setCname(String cname) {
this.cname = cname;
}
}
package com.boot.security.server.dto;
import java.util.HashMap;
import java.util.Map;
/**
* @author: l_cheng@ctrip.com
* @date: 2014-06-07
*/
public enum ProductPaymentTypeEnum {
PREPAY(1, "预付","P"),
DESK(2, "现付","O"),
CREDIT(3, "信用卡担保","G"),
PREPAY_AND_DESK(4, "部分预付","M");
private int value;
private String msg;
private String name;
private static Map<Integer, ProductPaymentTypeEnum> map = new HashMap<Integer, ProductPaymentTypeEnum>();
private static Map<String, ProductPaymentTypeEnum> nameMap = new HashMap<String, ProductPaymentTypeEnum>();
static {
for (ProductPaymentTypeEnum it : ProductPaymentTypeEnum.values()) {
nameMap.put(it.name, it);
}
}
static {
for (ProductPaymentTypeEnum it : ProductPaymentTypeEnum.values()) {
map.put(it.value, it);
}
}
ProductPaymentTypeEnum(int value, String msg,String name) {
this.value = value;
this.msg = msg;
this.name=name;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public static ProductPaymentTypeEnum nameOf(String name) {
return nameMap.get(name);
}
public static ProductPaymentTypeEnum valueOf(int value) {
return map.get(value);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.boot.security.server.dto;
import org.apache.commons.lang3.time.DateUtils;
import java.util.Calendar;
import java.util.Date;
public class UsrCommuneExtBean {
private Long id;
private String communeName;//会员姓名
private String mobilePhone;//手机号
private String uid;//会员uid
private String gender;//会员性别
private Date communeTime;//入社时间
private Date communeAgainTime;//续费时间
private Date communeEndTime;//社员到期时间
private Date birthday;//会员生日
private int score;//成绩
private int communeYears;//入社年数
private Date lastCommunicationTime;//最后沟通时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCommuneName() {
return communeName;
}
public void setCommuneName(String communeName) {
this.communeName = communeName;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public Date getLastCommunicationTime() {
return lastCommunicationTime;
}
public void setLastCommunicationTime(Date lastCommunicationTime) {
this.lastCommunicationTime = lastCommunicationTime;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public Date getCommuneTime() {
return communeTime;
}
public void setCommuneTime(Date communeTime) {
this.communeTime = communeTime;
}
public Date getCommuneAgainTime() {
return communeAgainTime;
}
public void setCommuneAgainTime(Date communeAgainTime) {
this.communeAgainTime = communeAgainTime;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public int getCommuneYears() {
return communeYears;
}
public void setCommuneYears(int communeYears) {
this.communeYears = communeYears;
}
public Date getCommuneEndTime() {
if(this.communeAgainTime==null){
return null;
}
if(communeEndTime==null){
communeEndTime = DateUtils.addYears(this.communeAgainTime, 1);
}
return communeEndTime;
}
public void setCommuneEndTime(Date communeEndTime) {
this.communeEndTime = communeEndTime;
}
}
package com.boot.security.server.model;
import java.util.Date;
public class AdmUsers extends BaseEntity<Long> {
private String username;
private String nickName;
private String password;
private Integer enable;
private Date DataChangeLastTime;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
public Date getDataChangeLastTime() {
return DataChangeLastTime;
}
public void setDataChangeLastTime(Date DataChangeLastTime) {
this.DataChangeLastTime = DataChangeLastTime;
}
}
package com.boot.security.server.model;
import java.util.Date;
public class CommuneAdm extends BaseEntity<Long> {
private Integer communeExtId;
private String uid;
private Integer admUserId;
private Date bindTime;
private String wechatRemark;
private Date wechatRemarkTime;
private String labels;
private Integer unbindFlag;
private Date lastCommunicationTime;
public Integer getCommuneExtId() {
return communeExtId;
}
public void setCommuneExtId(Integer communeExtId) {
this.communeExtId = communeExtId;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public Integer getAdmUserId() {
return admUserId;
}
public void setAdmUserId(Integer admUserId) {
this.admUserId = admUserId;
}
public Date getBindTime() {
return bindTime;
}
public void setBindTime(Date bindTime) {
this.bindTime = bindTime;
}
public String getWechatRemark() {
return wechatRemark;
}
public void setWechatRemark(String wechatRemark) {
this.wechatRemark = wechatRemark;
}
public Date getWechatRemarkTime() {
return wechatRemarkTime;
}
public void setWechatRemarkTime(Date wechatRemarkTime) {
this.wechatRemarkTime = wechatRemarkTime;
}
public String getLabels() {
return labels;
}
public void setLabels(String labels) {
this.labels = labels;
}
public Integer getUnbindFlag() {
return unbindFlag;
}
public void setUnbindFlag(Integer unbindFlag) {
this.unbindFlag = unbindFlag;
}
public Date getLastCommunicationTime() {
return lastCommunicationTime;
}
public void setLastCommunicationTime(Date lastCommunicationTime) {
this.lastCommunicationTime = lastCommunicationTime;
}
}
package com.boot.security.server.model; package com.boot.security.server.model;
import java.util.Date;
public class CommunicationRecord extends BaseEntity<Long> { public class CommunicationRecord extends BaseEntity<Long> {
private String uid; private String uid;
private String description; private String description;
private String attached; private String attachIds;
private Date communicationTime;
public String getUid() { public String getUid() {
return uid; return uid;
...@@ -20,11 +22,16 @@ public class CommunicationRecord extends BaseEntity<Long> { ...@@ -20,11 +22,16 @@ public class CommunicationRecord extends BaseEntity<Long> {
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
public String getAttached() { public String getAttachIds() {
return attached; return attachIds;
} }
public void setAttached(String attached) { public void setAttachIds(String attachIds) {
this.attached = attached; this.attachIds = attachIds;
}
public Date getCommunicationTime() {
return communicationTime;
}
public void setCommunicationTime(Date communicationTime) {
this.communicationTime = communicationTime;
} }
} }
package com.boot.security.server.model;
import java.util.Date;
public class Entityimage extends BaseEntity<Long> {
private Integer EntityID;
private String EntityType;
private String ext;
private String hash;
private String path;
private Integer Sort;
private String title;
public Integer getEntityID() {
return EntityID;
}
public void setEntityID(Integer EntityID) {
this.EntityID = EntityID;
}
public String getEntityType() {
return EntityType;
}
public void setEntityType(String EntityType) {
this.EntityType = EntityType;
}
public String getExt() {
return ext;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Integer getSort() {
return Sort;
}
public void setSort(Integer Sort) {
this.Sort = Sort;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
...@@ -3,16 +3,16 @@ package com.boot.security.server.model; ...@@ -3,16 +3,16 @@ package com.boot.security.server.model;
public class SysLogs extends BaseEntity<Long> { public class SysLogs extends BaseEntity<Long> {
private static final long serialVersionUID = -7809315432127036583L; private static final long serialVersionUID = -7809315432127036583L;
private SysUser user; private AdmUsers user;
private String module; private String module;
private Boolean flag; private Boolean flag;
private String remark; private String remark;
public SysUser getUser() { public AdmUsers getUser() {
return user; return user;
} }
public void setUser(SysUser user) { public void setUser(AdmUsers user) {
this.user = user; this.user = user;
} }
......
package com.boot.security.server.service;
import com.boot.security.server.dto.UserDto;
import com.boot.security.server.model.AdmUsers;
public interface AdminUserService {
AdmUsers saveUser(UserDto userDto);
AdmUsers updateUser(UserDto userDto);
AdmUsers getUser(String username);
void changePassword(String username, String oldPassword, String newPassword);
}
package com.boot.security.server.service.impl;
import com.boot.security.server.dao.AdmUsersDao;
import com.boot.security.server.dto.UserDto;
import com.boot.security.server.model.AdmUsers;
import com.boot.security.server.service.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AdminUserServiceImpl implements AdminUserService {
@Autowired
private AdmUsersDao admUsersDao;
@Override
public AdmUsers saveUser(UserDto userDto) {
return null;
}
@Override
public AdmUsers updateUser(UserDto userDto) {
return null;
}
@Override
public AdmUsers getUser(String username) {
return admUsersDao.getUser(username);
}
@Override
public void changePassword(String username, String oldPassword, String newPassword) {
}
}
package com.boot.security.server.service.impl;
import java.io.*;
import com.boot.security.server.dto.EntityImageBean;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.FileInfo;
import com.qiniu.util.Auth;
import com.qiniu.util.StringMap;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.ResponseBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* 七牛文件上传管理器
* <p/>
* 一般默认可以使用这个类的方法来上传数据和文件。这个类自动检测文件的大小, 只要超过了{@link com.qiniu.common.Config#PUT_THRESHOLD}
*/
@Service
public final class ImageService {
private Logger logger = LoggerFactory.getLogger(ImageService.class);
@Value("${qiniu.accessKey}")
private String accessKey;
@Value("${qiniu.secretKey}")
private String secretKey;
@Value("${qiniu.bucketName}")
private String bucketName;
private UploadManager uploadManager = null;
private Auth auth = null;
private BucketManager bucketManager = null;
// 简单上传,使用默认策略
private String getUpToken() {
return auth.uploadToken(bucketName);
}
// 覆盖上传
private String getUpToken1() {
return auth.uploadToken(bucketName, "key");
}
// 设置指定上传策略
private String getUpToken2() {
return auth.uploadToken(bucketName, null, 3600, new StringMap().put("saveKey", "${etag}${ext}"));
}
// 去除非限定的策略字段
private String getUpToken3() {
return auth.uploadToken(bucketName, null, 3600, new StringMap().put("endUser", "uid").putNotEmpty("returnBody", ""), true);
}
/**
* 生成上传token
*
* @param bucket 空间名
* @param key key,可为 null
* @param expires 有效时长,单位秒。默认3600s
* @param policy 上传策略的其它参数,如 new StringMap().put("endUser", "uid").putNotEmpty("returnBody", "")。 scope通过 bucket、key间接设置,deadline 通过 expires 间接设置
* @param strict 是否去除非限定的策略字段,默认true
* @return 生成的上传token
*/
public String uploadToken0(String bucket, String key, long expires, StringMap policy, boolean strict) {
return null;
}
// 上传内存中数据
public EntityImageBean upload(byte[] data, String key) {
if(auth==null||uploadManager==null||bucketManager==null){
auth = Auth.create(accessKey, secretKey);
uploadManager = new UploadManager();
bucketManager = new BucketManager(auth);
}
StringMap map = null;
EntityImageBean entityImageBean = new EntityImageBean();
try {
Response res = uploadManager.put(data, key, getUpToken2());
if (res.isOK()) {
map = res.jsonToMap();
String name = map.get("key").toString();
String arr[] = name.split("\\.");
entityImageBean.setHash(map.get("key").toString().replace("."+arr[arr.length-1], ""));
entityImageBean.setExt(arr[arr.length-1]);
entityImageBean.setPath("/");
}
} catch (QiniuException e) {
Response r = e.response;
logger.error("Image upload Failed", e);
throw new RuntimeException();
}
return entityImageBean;
}
private String getDownloadUrl(String targetUrl) {
if(auth==null||uploadManager==null||bucketManager==null){
auth = Auth.create(accessKey, secretKey);
uploadManager = new UploadManager();
bucketManager = new BucketManager(auth);
}
String downloadUrl = auth.privateDownloadUrl(targetUrl);
return downloadUrl;
}
public ResponseBody download(String targetUrl) {
String downloadUrl = getDownloadUrl(targetUrl);
OkHttpClient client = new OkHttpClient();
Request req = new Request.Builder().url(downloadUrl).build();
com.squareup.okhttp.Response resp = null;
try {
resp = client.newCall(req).execute();
if (resp.isSuccessful()) {
ResponseBody body = resp.body();
return body;
}
} catch (IOException e) {
e.printStackTrace();
System.out.println("Unexpected code " + resp);
}
return null;
}
public void uploadFilePath(String filePath) {
String key = null;
try {
Response res = uploadManager.put(filePath, key, getUpToken());
StringMap map = res.jsonToMap();
FileInfo info = bucketManager.stat("ofrog", map.get("key").toString());
// log.info(res.bodyString());
logger.info(info.toString());
logger.info(map.get("key").toString());
} catch (QiniuException e) {
// Response r = e.response;
// log.info(r);
// log.info(r.bodyString());
// e.printStackTrace();
// dosomething
}
}
public void uploadFile(File file) {
String key = null;
try {
Response res = uploadManager.put(file, key, getUpToken());
// log.info(res);
// log.info(res.bodyString());
} catch (QiniuException e) {
// Response r = e.response;
// log.info(r);
// log.info(r.bodyString());
// e.printStackTrace();
// dosomething
}
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.boot.security.server.service.impl; ...@@ -2,6 +2,7 @@ package com.boot.security.server.service.impl;
import java.util.Date; import java.util.Date;
import com.boot.security.server.model.AdmUsers;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -49,7 +50,7 @@ public class SysLogServiceImpl implements SysLogService { ...@@ -49,7 +50,7 @@ public class SysLogServiceImpl implements SysLogService {
sysLogs.setModule(module); sysLogs.setModule(module);
sysLogs.setRemark(remark); sysLogs.setRemark(remark);
SysUser user = new SysUser(); AdmUsers user = new AdmUsers();
user.setId(userId); user.setId(userId);
sysLogs.setUser(user); sysLogs.setUser(user);
......
...@@ -2,6 +2,8 @@ package com.boot.security.server.service.impl; ...@@ -2,6 +2,8 @@ package com.boot.security.server.service.impl;
import java.util.List; import java.util.List;
import com.boot.security.server.model.AdmUsers;
import com.boot.security.server.service.AdminUserService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
...@@ -17,7 +19,6 @@ import com.boot.security.server.dto.LoginUser; ...@@ -17,7 +19,6 @@ import com.boot.security.server.dto.LoginUser;
import com.boot.security.server.model.Permission; import com.boot.security.server.model.Permission;
import com.boot.security.server.model.SysUser; import com.boot.security.server.model.SysUser;
import com.boot.security.server.model.SysUser.Status; import com.boot.security.server.model.SysUser.Status;
import com.boot.security.server.service.UserService;
/** /**
* spring security登陆处理<br> * spring security登陆处理<br>
...@@ -30,25 +31,23 @@ import com.boot.security.server.service.UserService; ...@@ -30,25 +31,23 @@ import com.boot.security.server.service.UserService;
public class UserDetailsServiceImpl implements UserDetailsService { public class UserDetailsServiceImpl implements UserDetailsService {
@Autowired @Autowired
private UserService userService; private AdminUserService adminUserService;
@Autowired @Autowired
private PermissionDao permissionDao; private PermissionDao permissionDao;
@Override @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
SysUser sysUser = userService.getUser(username); AdmUsers admUsers = adminUserService.getUser(username);
if (sysUser == null) { if (admUsers == null) {
throw new AuthenticationCredentialsNotFoundException("用户名不存在"); throw new AuthenticationCredentialsNotFoundException("用户名不存在");
} else if (sysUser.getStatus() == Status.LOCKED) { } else if (admUsers.getEnable() == Status.DISABLED) {
throw new LockedException("用户被锁定,请联系管理员");
} else if (sysUser.getStatus() == Status.DISABLED) {
throw new DisabledException("用户已作废"); throw new DisabledException("用户已作废");
} }
LoginUser loginUser = new LoginUser(); LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(sysUser, loginUser); BeanUtils.copyProperties(admUsers, loginUser);
List<Permission> permissions = permissionDao.listByUserId(sysUser.getId()); List<Permission> permissions = permissionDao.listByUserId(loginUser.getId());
loginUser.setPermissions(permissions); loginUser.setPermissions(permissions);
return loginUser; return loginUser;
......
...@@ -3,3 +3,7 @@ spring: ...@@ -3,3 +3,7 @@ spring:
url: jdbc:mysql://192.168.10.5:3306/fundb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false url: jdbc:mysql://192.168.10.5:3306/fundb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: root username: root
password: root password: root
qiniu:
accessKey: s_FZUyzvhxv10JMRzJOBwy5rObZWYlEwwNC9rVt2
secretKey: flCPDL5VVrWx4n9VnzSr6zN1wN4XZega_3cWPqmH
bucketName: ofrog
\ No newline at end of file
...@@ -3,3 +3,7 @@ spring: ...@@ -3,3 +3,7 @@ spring:
url: jdbc:mysql://192.168.1.169:3306/fundb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false url: jdbc:mysql://192.168.1.169:3306/fundb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: iwan username: iwan
password: 123456789@qaz password: 123456789@qaz
qiniu:
accessKey: s56-PMBhHGrK1KCnWsmAKlh6X5X5NHqhvD0QE024
secretKey: hNIZ_7THzWQMleYtLZdHE0Fiw6J78LIa0gx06RJw
bucketName: ofrog
\ No newline at end of file
...@@ -3,3 +3,7 @@ spring: ...@@ -3,3 +3,7 @@ spring:
url: jdbc:mysql://192.168.10.5:3306/fundb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false url: jdbc:mysql://192.168.10.5:3306/fundb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: root username: root
password: root password: root
qiniu:
accessKey: s56-PMBhHGrK1KCnWsmAKlh6X5X5NHqhvD0QE024
secretKey: hNIZ_7THzWQMleYtLZdHE0Fiw6J78LIa0gx06RJw
bucketName: ofrog
\ No newline at end of file
...@@ -62,4 +62,4 @@ token: ...@@ -62,4 +62,4 @@ token:
seconds: 864000 seconds: 864000
jwtSecret: (XIAO:)_$^11244^%$_(WEI:)_@@++--(LAO:)_++++_.sds_(SHI:) jwtSecret: (XIAO:)_$^11244^%$_(WEI:)_@@++--(LAO:)_++++_.sds_(SHI:)
server: server:
port: 9080 port: 8080
\ No newline at end of file \ No newline at end of file
<?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.boot.security.server.dao.CommuneAdmDao">
<sql id="where">
<where>
<if test="params.id != null and params.id != ''">
and id = #{params.id}
</if>
<if test="params.communeExtId != null and params.communeExtId != ''">
and communeExtId = #{params.communeExtId}
</if>
<if test="params.uid != null and params.uid != ''">
and uid = #{params.uid}
</if>
<if test="params.admUserId != null and params.admUserId != ''">
and admUserId = #{params.admUserId}
</if>
<if test="params.bindTime != null and params.bindTime != ''">
and bindTime = #{params.bindTime}
</if>
<if test="params.wechatRemark != null and params.wechatRemark != ''">
and wechatRemark = #{params.wechatRemark}
</if>
<if test="params.wechatRemarkTime != null and params.wechatRemarkTime != ''">
and wechatRemarkTime = #{params.wechatRemarkTime}
</if>
<if test="params.labels != null and params.labels != ''">
and labels = #{params.labels}
</if>
<if test="params.unbindFlag != null and params.unbindFlag != ''">
and unbindFlag = #{params.unbindFlag}
</if>
<if test="params.lastCommunicationTime != null and params.lastCommunicationTime != ''">
and lastCommunicationTime = #{params.lastCommunicationTime}
</if>
</where>
</sql>
<select id="count" resultType="int">
select count(1) from usr_commune_adm t
<include refid="where" />
</select>
<select id="list" resultType="CommuneAdm">
select * from usr_commune_adm t
<include refid="where" />
${params.orderBy}
limit #{offset}, #{limit}
</select>
<update id="update">
update usr_commune_adm t
<set>
<if test="communeExtId != null">
communeExtId = #{communeExtId},
</if>
<if test="uid != null">
uid = #{uid},
</if>
<if test="admUserId != null">
admUserId = #{admUserId},
</if>
<if test="bindTime != null">
bindTime = #{bindTime},
</if>
<if test="wechatRemark != null">
wechatRemark = #{wechatRemark},
</if>
<if test="wechatRemarkTime != null">
wechatRemarkTime = #{wechatRemarkTime},
</if>
<if test="labels != null">
labels = #{labels},
</if>
<if test="unbindFlag != null">
unbindFlag = #{unbindFlag},
</if>
<if test="lastCommunicationTime != null">
lastCommunicationTime = #{lastCommunicationTime},
</if>
</set>
where t.id = #{id}
</update>
</mapper>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<if test="params.description != null and params.description != ''"> <if test="params.description != null and params.description != ''">
and description = #{params.description} and description = #{params.description}
</if> </if>
<if test="params.attached != null and params.attached != ''"> <if test="params.attachIds != null and params.attachIds != ''">
and attached = #{params.attached} and attached = #{params.attached}
</if> </if>
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
<if test="description != null"> <if test="description != null">
description = #{description}, description = #{description},
</if> </if>
<if test="attached != null"> <if test="attachIds != null">
attached = #{attached}, attachIds = #{attachIds},
</if> </if>
</set> </set>
......
<?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.boot.security.server.dao.EntityimageDao">
<sql id="where">
<where>
<if test="params.ID != null and params.ID != ''">
and ID = #{params.ID}
</if>
<if test="params.CreatedTime != null and params.CreatedTime != ''">
and CreatedTime = #{params.CreatedTime}
</if>
<if test="params.DataChange_LastTime != null and params.DataChange_LastTime != ''">
and DataChange_LastTime = #{params.DataChangeLastTime}
</if>
<if test="params.EntityID != null and params.EntityID != ''">
and EntityID = #{params.EntityID}
</if>
<if test="params.EntityType != null and params.EntityType != ''">
and EntityType = #{params.EntityType}
</if>
<if test="params.ext != null and params.ext != ''">
and ext = #{params.ext}
</if>
<if test="params.hash != null and params.hash != ''">
and hash = #{params.hash}
</if>
<if test="params.path != null and params.path != ''">
and path = #{params.path}
</if>
<if test="params.Sort != null and params.Sort != ''">
and Sort = #{params.Sort}
</if>
<if test="params.title != null and params.title != ''">
and title = #{params.title}
</if>
</where>
</sql>
<select id="count" resultType="int">
select count(1) from bsc_entityimage t
<include refid="where" />
</select>
<select id="list" resultType="Entityimage">
select * from bsc_entityimage t
<include refid="where" />
${params.orderBy}
limit #{offset}, #{limit}
</select>
<update id="update">
update bsc_entityimage t
<set>
<if test="ID != null">
ID = #{ID},
</if>
<if test="CreatedTime != null">
CreatedTime = #{CreatedTime},
</if>
<if test="DataChange_LastTime != null">
DataChange_LastTime = #{DataChangeLastTime},
</if>
<if test="EntityID != null">
EntityID = #{EntityID},
</if>
<if test="EntityType != null">
EntityType = #{EntityType},
</if>
<if test="ext != null">
ext = #{ext},
</if>
<if test="hash != null">
hash = #{hash},
</if>
<if test="path != null">
path = #{path},
</if>
<if test="Sort != null">
Sort = #{Sort},
</if>
<if test="title != null">
title = #{title},
</if>
</set>
where t.id = #{id}
</update>
</mapper>
...@@ -62,11 +62,14 @@ ...@@ -62,11 +62,14 @@
<if test="params.OnPayAmount != null and params.OnPayAmount != ''"> <if test="params.OnPayAmount != null and params.OnPayAmount != ''">
and OnPayAmount = #{params.OnPayAmount} and OnPayAmount = #{params.OnPayAmount}
</if> </if>
<if test="params.OrderDate != null and params.OrderDate != ''"> <if test="params.orderDateStart != null and params.orderDateStart != ''">
and OrderDate = #{params.OrderDate} and OrderDate &gt; #{params.orderDateStart}
</if> </if>
<if test="params.OrderName != null and params.OrderName != ''"> <if test="params.orderDateEnd != null and params.orderDateEnd != ''">
and OrderName = #{params.OrderName} and OrderDate &lt; #{params.orderDateEnd}
</if>
<if test="params.orderName != null and params.orderName != ''">
and OrderName like '%${params.orderName}%'
</if> </if>
<if test="params.OrderNo != null and params.OrderNo != ''"> <if test="params.OrderNo != null and params.OrderNo != ''">
and OrderNo = #{params.OrderNo} and OrderNo = #{params.OrderNo}
...@@ -113,8 +116,8 @@ ...@@ -113,8 +116,8 @@
<if test="params.TotalAmount != null and params.TotalAmount != ''"> <if test="params.TotalAmount != null and params.TotalAmount != ''">
and TotalAmount = #{params.TotalAmount} and TotalAmount = #{params.TotalAmount}
</if> </if>
<if test="params.Uid != null and params.Uid != ''"> <if test="params.uid != null and params.uid != ''">
and Uid = #{params.Uid} and Uid = #{params.uid}
</if> </if>
<if test="params.UnlimitedEMoneyAmount != null and params.UnlimitedEMoneyAmount != ''"> <if test="params.UnlimitedEMoneyAmount != null and params.UnlimitedEMoneyAmount != ''">
and UnlimitedEMoneyAmount = #{params.UnlimitedEMoneyAmount} and UnlimitedEMoneyAmount = #{params.UnlimitedEMoneyAmount}
...@@ -134,8 +137,8 @@ ...@@ -134,8 +137,8 @@
<if test="params.PayDate != null and params.PayDate != ''"> <if test="params.PayDate != null and params.PayDate != ''">
and PayDate = #{params.PayDate} and PayDate = #{params.PayDate}
</if> </if>
<if test="params.OrderCategory != null and params.OrderCategory != ''"> <if test="params.orderCategory != null and params.orderCategory != ''">
and OrderCategory = #{params.OrderCategory} and OrderCategory = #{params.orderCategory}
</if> </if>
<if test="params.GuaranteeAmount != null and params.GuaranteeAmount != ''"> <if test="params.GuaranteeAmount != null and params.GuaranteeAmount != ''">
and GuaranteeAmount = #{params.GuaranteeAmount} and GuaranteeAmount = #{params.GuaranteeAmount}
...@@ -402,8 +405,8 @@ ...@@ -402,8 +405,8 @@
<if test="OrderDate != null"> <if test="OrderDate != null">
OrderDate = #{OrderDate}, OrderDate = #{OrderDate},
</if> </if>
<if test="OrderName != null"> <if test="orderName != null">
OrderName = #{OrderName}, OrderName like #{orderName},
</if> </if>
<if test="OrderNo != null"> <if test="OrderNo != null">
OrderNo = #{OrderNo}, OrderNo = #{OrderNo},
...@@ -450,8 +453,8 @@ ...@@ -450,8 +453,8 @@
<if test="TotalAmount != null"> <if test="TotalAmount != null">
TotalAmount = #{TotalAmount}, TotalAmount = #{TotalAmount},
</if> </if>
<if test="Uid != null"> <if test="params.uid != null">
Uid = #{Uid}, and Uid = #{params.uid}
</if> </if>
<if test="UnlimitedEMoneyAmount != null"> <if test="UnlimitedEMoneyAmount != null">
UnlimitedEMoneyAmount = #{UnlimitedEMoneyAmount}, UnlimitedEMoneyAmount = #{UnlimitedEMoneyAmount},
...@@ -471,8 +474,8 @@ ...@@ -471,8 +474,8 @@
<if test="PayDate != null"> <if test="PayDate != null">
PayDate = #{PayDate}, PayDate = #{PayDate},
</if> </if>
<if test="OrderCategory != null"> <if test="orderCategory != null">
OrderCategory = #{OrderCategory}, OrderCategory = #{orderCategory},
</if> </if>
<if test="GuaranteeAmount != null"> <if test="GuaranteeAmount != null">
GuaranteeAmount = #{GuaranteeAmount}, GuaranteeAmount = #{GuaranteeAmount},
......
...@@ -90,6 +90,102 @@ ...@@ -90,6 +90,102 @@
limit #{offset}, #{limit} limit #{offset}, #{limit}
</select> </select>
<select id="countBean" resultType="int">
SELECT count(*)
FROM usr_commune_ext a LEFT JOIN bsc_UserExt b ON a.uid = b.uid LEFT JOIN usr_commune_adm c ON (a.ID=c.communeExtId)
WHERE
1 = 1
<if test="params.admUserId != null and params.admUserId != ''">
and c.admUserId = #{params.admUserId}
</if>
<if test="params.communeName != null and params.communeName != ''">
and a.userName like concat('%', #{params.communeName}, '%')
</if>
<if test="params.uid != null and params.uid != ''">
and b.uid = #{params.uid}
</if>
<if test="params.mobilePhone != null and params.mobilePhone != ''">
and a.mobilePhone = #{params.mobilePhone}
</if>
<if test="params.lastCommunicationTimeStart != null">
and c.lastCommunicationTime &gt; #{params.lastCommunicationTimeStart}
</if>
<if test="params.lastCommunicationTimeEnd != null">
and c.lastCommunicationTime &lt; #{params.lastCommunicationTimeEnd}
</if>
<if test="params.nonCommunication != null">
and c.lastCommunicationTime is null
</if>
<if test="params.communeTimeStart != null">
and b.communeTime &gt; #{params.communeTimeStart}
</if>
<if test="params.communeTimeEnd != null">
and b.communeTime &lt; #{params.communeTimeEnd}
</if>
<if test="params.communeAgainTimeStart != null">
and b.communeAgainTime &gt; #{params.communeAgainTimeStart}
</if>
<if test="params.communeAgainTimeEnd != null">
and b.communeAgainTime &lt; #{params.communeAgainTimeEnd}
</if>
</select>
<select id="listBean" resultType="com.boot.security.server.dto.UsrCommuneExtBean">
SELECT a.id,a.Birthday,a.gender,a.mobilePhone,a.score,b.uid,a.userName communeName,b.communeAgainTime,b.communeTime,IFNULL(b.communeYears, 0) AS communeYears,c.lastCommunicationTime
FROM usr_commune_ext a LEFT JOIN bsc_UserExt b ON a.uid = b.uid LEFT JOIN usr_commune_adm c ON (a.ID=c.communeExtId)
WHERE
1 = 1
<if test="params.admUserId != null and params.admUserId != ''">
and c.admUserId = #{params.admUserId}
</if>
<if test="params.communeName != null and params.communeName != ''">
and a.userName like concat('%', #{params.communeName}, '%')
</if>
<if test="params.uid != null and params.uid != ''">
and b.uid = #{params.uid}
</if>
<if test="params.mobilePhone != null and params.mobilePhone != ''">
and a.mobilePhone = #{params.mobilePhone}
</if>
<if test="params.lastCommunicationTimeStart != null">
and c.lastCommunicationTime &gt; #{params.lastCommunicationTimeStart}
</if>
<if test="params.lastCommunicationTimeEnd != null">
and c.lastCommunicationTime &lt; #{params.lastCommunicationTimeEnd}
</if>
<if test="params.nonCommunication != null">
and c.lastCommunicationTime is null
</if>
<if test="params.communeTimeStart != null">
and b.communeTime &gt; #{params.communeTimeStart}
</if>
<if test="params.communeTimeEnd != null">
and b.communeTime &lt; #{params.communeTimeEnd}
</if>
<if test="params.communeAgainTimeStart != null">
and b.communeAgainTime &gt; #{params.communeAgainTimeStart}
</if>
<if test="params.communeAgainTimeEnd != null">
and b.communeAgainTime &lt; #{params.communeAgainTimeEnd}
</if>
${params.orderBy}
limit #{offset}, #{limit}
</select>
<select id="getBeanById" resultType="com.boot.security.server.dto.UsrCommuneExtBean">
SELECT a.id,a.Birthday,a.gender,a.mobilePhone,a.score,b.uid,a.userName communeName,b.communeAgainTime,b.communeTime,IFNULL(b.communeYears, 0) AS communeYears,c.lastCommunicationTime
FROM usr_commune_ext a LEFT JOIN bsc_UserExt b ON a.uid = b.uid LEFT JOIN usr_commune_adm c ON (a.ID=c.communeExtId)
WHERE 1 = 1
<if test="id != null">
and a.id = #{id}
</if>
</select>
<update id="update"> <update id="update">
update usr_commune_ext t update usr_commune_ext t
<set> <set>
......
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 sign in to comment