修改防止订单不生成

This commit is contained in:
yuyang 2022-03-17 12:03:41 +08:00
parent a59d48615b
commit 350ea92e71
29 changed files with 557 additions and 100 deletions

View File

@ -1,7 +1,14 @@
package com.xhpc.system.controller;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@ -35,6 +42,8 @@ public class SysDeptController extends BaseController
{
@Autowired
private ISysDeptService deptService;
@Autowired
private TokenService tokenService;
/**
* 获取部门列表
@ -43,8 +52,17 @@ public class SysDeptController extends BaseController
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
SysUser sysUser = loginUser.getSysUser();
if(tenantId !=null && !"".equals(tenantId)){
if(sysUser.getUserId() != UserTypeUtil.USER_ID){
dept.setDeptId(sysUser.getDeptId());
}
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
}
return AjaxResult.success(new ArrayList<>());
}
/**
@ -84,8 +102,17 @@ public class SysDeptController extends BaseController
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
SysUser sysUser = loginUser.getSysUser();
if(tenantId !=null && !"".equals(tenantId)){
if(sysUser.getUserId() != UserTypeUtil.USER_ID){
dept.setDeptId(sysUser.getDeptId());
}
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
return AjaxResult.success(new ArrayList<>());
}
/**

View File

@ -1,9 +1,15 @@
package com.xhpc.system.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.system.api.domain.SysDept;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import com.xhpc.system.domain.SysPost;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@ -37,7 +43,8 @@ public class SysPostController extends BaseController
{
@Autowired
private ISysPostService postService;
@Autowired
private TokenService tokenService;
/**
* 获取岗位列表
*/
@ -45,9 +52,18 @@ public class SysPostController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
SysUser sysUser = loginUser.getSysUser();
if(tenantId !=null && !"".equals(tenantId)){
if(sysUser.getUserId() != UserTypeUtil.USER_ID){
post.setTenantId(sysUser.getTenantId());
}
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
return getDataTable(new ArrayList<>());
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@ -55,9 +71,20 @@ public class SysPostController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, SysPost post) throws IOException
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
SysUser sysUser = loginUser.getSysUser();
if(tenantId !=null && !"".equals(tenantId)){
if(sysUser.getUserId() != UserTypeUtil.USER_ID){
post.setTenantId(sysUser.getTenantId());
}
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
}else{
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, new ArrayList<>(), "岗位数据");
}
}
/**
@ -78,6 +105,9 @@ public class SysPostController extends BaseController
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post)
{
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
post.setTenantId(tenantId);
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
@ -98,6 +128,9 @@ public class SysPostController extends BaseController
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post)
{
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
post.setTenantId(tenantId);
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
@ -127,7 +160,12 @@ public class SysPostController extends BaseController
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysPost> posts = postService.selectPostAll();
return AjaxResult.success(posts);
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
if(tenantId !=null && !"".equals(tenantId)){
List<SysPost> posts = postService.selectPostAll(tenantId);
return AjaxResult.success(posts);
}
return AjaxResult.success(new ArrayList<>());
}
}

View File

@ -11,6 +11,7 @@ import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.annotation.PreAuthorize;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.system.api.domain.SysRole;
import com.xhpc.system.api.domain.SysUser;
@ -51,7 +52,8 @@ public class SysUserController extends BaseController {
@Autowired
private IXhpcDataDimensionService dataDimensionService;
@Autowired
private TokenService tokenService;
/**
* 获取用户列表
@ -59,6 +61,8 @@ public class SysUserController extends BaseController {
@PreAuthorize(hasPermi = "system:user:list")
@GetMapping("/list")
public TableDataInfo list(SysUser user) {
LoginUser loginUser = tokenService.getLoginUser();
user.setTenantId(loginUser.getTenantId());
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
@ -143,10 +147,12 @@ public class SysUserController extends BaseController {
@PreAuthorize(hasPermi = "system:user:query")
@GetMapping(value = {"/", "/{userId}"})
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll());
ajax.put("posts", postService.selectPostAll(tenantId));
if (StringUtils.isNotNull(userId)) {
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
ajax.put("postIds", postService.selectPostListByUserId(userId));
@ -162,7 +168,13 @@ public class SysUserController extends BaseController {
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user) {
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
if(user.getTenantId() ==null){
return AjaxResult.error("请选择租户");
}
if(user.getRoleIds().length==0){
return AjaxResult.error("请选择角色");
}
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName(),user.getTenantId()))) {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {

View File

@ -3,6 +3,7 @@ package com.xhpc.system.mapper;
import java.util.List;
import com.xhpc.system.domain.SysPost;
import org.apache.ibatis.annotations.Param;
/**
* 岗位信息 数据层
@ -24,7 +25,7 @@ public interface SysPostMapper
*
* @return 岗位列表
*/
public List<SysPost> selectPostAll();
public List<SysPost> selectPostAll(@Param("tenantId")String tenantId);
/**
* 通过岗位ID查询岗位信息
@ -88,7 +89,7 @@ public interface SysPostMapper
* @param postName 岗位名称
* @return 结果
*/
public SysPost checkPostNameUnique(String postName);
public SysPost checkPostNameUnique(@Param("postName")String postName,@Param("tenantId")String tenantId);
/**
* 校验岗位编码
@ -96,5 +97,5 @@ public interface SysPostMapper
* @param postCode 岗位编码
* @return 结果
*/
public SysPost checkPostCodeUnique(String postCode);
public SysPost checkPostCodeUnique(@Param("postCode")String postCode,@Param("tenantId")String tenantId);
}

View File

@ -107,7 +107,7 @@ public interface SysUserMapper {
* @param userName 用户名称
* @return 结果
*/
public int checkUserNameUnique(String userName);
public int checkUserNameUnique(@Param("userName") String userName,@Param("tenantId")String tenantId);
/**
* 校验手机号码是否唯一
@ -115,7 +115,7 @@ public interface SysUserMapper {
* @param phonenumber 手机号码
* @return 结果
*/
public SysUser checkPhoneUnique(String phonenumber);
public SysUser checkPhoneUnique(@Param("phonenumber")String phonenumber,@Param("tenantId")String tenantId);
/**
* 校验email是否唯一

View File

@ -24,7 +24,7 @@ public interface ISysPostService
*
* @return 岗位列表
*/
public List<SysPost> selectPostAll();
public List<SysPost> selectPostAll(String tenantId);
/**
* 通过岗位ID查询岗位信息

View File

@ -72,7 +72,7 @@ public interface ISysUserService {
* @param userName 用户名称
* @return 结果
*/
public String checkUserNameUnique(String userName);
public String checkUserNameUnique(String userName,String tenantId);
/**
* 校验手机号码是否唯一

View File

@ -45,9 +45,9 @@ public class SysPostServiceImpl implements ISysPostService
* @return 岗位列表
*/
@Override
public List<SysPost> selectPostAll()
public List<SysPost> selectPostAll(String tenantId)
{
return postMapper.selectPostAll();
return postMapper.selectPostAll(tenantId);
}
/**
@ -84,7 +84,7 @@ public class SysPostServiceImpl implements ISysPostService
public String checkPostNameUnique(SysPost post)
{
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
SysPost info = postMapper.checkPostNameUnique(post.getPostName(),post.getTenantId());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
return UserConstants.NOT_UNIQUE;
@ -102,7 +102,7 @@ public class SysPostServiceImpl implements ISysPostService
public String checkPostCodeUnique(SysPost post)
{
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode(),post.getTenantId());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
return UserConstants.NOT_UNIQUE;

View File

@ -168,9 +168,9 @@ public class SysUserServiceImpl implements ISysUserService
* @return 结果
*/
@Override
public String checkUserNameUnique(String userName)
public String checkUserNameUnique(String userName,String tenantId)
{
int count = userMapper.checkUserNameUnique(userName);
int count = userMapper.checkUserNameUnique(userName,tenantId);
if (count > 0)
{
return UserConstants.NOT_UNIQUE;
@ -188,7 +188,7 @@ public class SysUserServiceImpl implements ISysUserService
public String checkPhoneUnique(SysUser user)
{
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber(),user.getTenantId());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
return UserConstants.NOT_UNIQUE;

View File

@ -38,6 +38,9 @@
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
@ -46,6 +49,10 @@
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where 1=1
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
@ -71,12 +78,20 @@
<select id="checkPostNameUnique" parameterType="java.lang.String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
where post_name=#{postName}
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
limit 1
</select>
<select id="checkPostCodeUnique" parameterType="java.lang.String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
where post_code=#{postCode}
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
limit 1
</select>
<update id="updatePost" parameterType="com.xhpc.system.domain.SysPost">

View File

@ -44,6 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptId != null">
AND(dept_id = #{deptId} or parent_id= #{deptId})
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>

View File

@ -173,11 +173,21 @@
</select>
<select id="checkUserNameUnique" parameterType="java.lang.String" resultType="int">
select count(1) from sys_user where user_name = #{userName} limit 1
select count(1) from sys_user
where user_name = #{userName}
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
limit 1
</select>
<select id="checkPhoneUnique" parameterType="java.lang.String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
select user_id, phonenumber from sys_user
where phonenumber = #{phonenumber}
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
limit 1
</select>
<select id="checkEmailUnique" parameterType="java.lang.String" resultMap="SysUserResult">

View File

@ -2,6 +2,7 @@ package com.xhpc.common.util;
import cn.hutool.Hutool;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
@ -456,6 +457,7 @@ public class DateUtil {
return week;
}
public static String getNowDateStr() {
Calendar now = Calendar.getInstance();
@ -494,6 +496,9 @@ public class DateUtil {
// DateUtil.isWeekend(DateUtil.string2Date("2016-06-12", "yyyy-MM-dd"));
// DateUtil.isWeekend(DateUtil.string2Date("2016-06-13", "yyyy-MM-dd"));
// DateUtil.isWeekend(DateUtil.string2Date("2016-06-14", "yyyy-MM-dd"));
String data = DateUtil.week(new Date());
System.out.println("data"+data);
}
}

View File

@ -5,8 +5,11 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.general.domain.XhpcAgreement;
import com.xhpc.general.service.IXhpcAgreementService;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -22,34 +25,41 @@ public class XhpcAgreementController extends BaseController {
@Autowired
IXhpcAgreementService iXhpcAgreementService;
@Autowired
TokenService tokenService;
@Log(title = "协议-删除", businessType = BusinessType.DELETE)
@PostMapping("/delete")
public AjaxResult delete(@RequestBody XhpcAgreement xhpcAgreement){
return iXhpcAgreementService.deleteAgreementItem(xhpcAgreement.getAgreementId());
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
return iXhpcAgreementService.deleteAgreementItem(xhpcAgreement.getAgreementId(),tenantId);
}
@Log(title = "协议-添加", businessType = BusinessType.DELETE)
@PostMapping("/add")
public AjaxResult add(@RequestBody XhpcAgreement xhpcAgreement){
return iXhpcAgreementService.insertAgreementItem(xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent());
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
xhpcAgreement.setTenantId(tenantId);
return iXhpcAgreementService.insertAgreementItem(xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent(),tenantId);
}
@Log(title = "协议-编辑", businessType = BusinessType.UPDATE)
@PostMapping("/update")
public AjaxResult update(@RequestBody XhpcAgreement xhpcAgreement){
return iXhpcAgreementService.updateAgreementItem(xhpcAgreement.getAgreementId(),xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent()
);
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
xhpcAgreement.setTenantId(tenantId);
return iXhpcAgreementService.updateAgreementItem(xhpcAgreement.getAgreementId(),xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent(),tenantId);
}
@GetMapping("/listAll")
public TableDataInfo listAll( String title,String createBy,Integer type){
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
startPage();
return getDataTable(iXhpcAgreementService.selectAgreementItems(title,createBy,type));
return getDataTable(iXhpcAgreementService.selectAgreementItems(title,createBy,type,tenantId));
}
@GetMapping("/listOne")
@ -59,9 +69,9 @@ public class XhpcAgreementController extends BaseController {
}
@GetMapping("/getContent")
public AjaxResult getContent(@RequestParam Integer type){
public AjaxResult getContent(Integer type,String tenantId){
return AjaxResult.success(iXhpcAgreementService.selectContent(type));
return AjaxResult.success(iXhpcAgreementService.selectContent(type,tenantId));
}
}

View File

@ -14,7 +14,7 @@ import java.util.List;
*/
public interface XhpcAgreementMapper {
int deleteAgreementItem(@Param("agreementId") Long agreementId);
int deleteAgreementItem(@Param("agreementId") Long agreementId,@Param("tenantId") String tenantId);
/**
* Getting the number of title which is fit with the type.
@ -22,17 +22,17 @@ public interface XhpcAgreementMapper {
* @param title
* @return
*/
int countSameTypeTitle(@Param("type") Integer type,@Param("title") String title);
int countSameTypeTitle(@Param("type") Integer type,@Param("title") String title,@Param("tenantId") String tenantId);
int insertAgreementItem(@Param("title") String title,@Param("type") Integer type,@Param("content") String content);
int insertAgreementItem(@Param("title") String title,@Param("type") Integer type,@Param("content") String content,@Param("tenantId") String tenantId);
int updateAgreementItem(@Param("agreementId") Long agreementId,@Param("title") String title,@Param("type")Integer type,@Param("content") String content);
int updateAgreementItem(@Param("agreementId") Long agreementId,@Param("title") String title,@Param("type")Integer type,@Param("content") String content,@Param("tenantId") String tenantId);
List<XhpcAgreement> selectAgreementItems(@Param("title") String title, @Param("createBy") String createBy, @Param("type") Integer type);
List<XhpcAgreement> selectAgreementItems(@Param("title") String title, @Param("createBy") String createBy, @Param("type") Integer type,@Param("tenantId")String tenantId);
XhpcAgreement selectAgreementItem(@Param("agreementId") Long agreementId);
XhpcAgreement selectContentType(@Param("type") Integer type);
XhpcAgreement selectContentType(@Param("type") Integer type,@Param("tenantId")String tenantId);
}

View File

@ -13,16 +13,16 @@ import java.util.List;
*/
public interface IXhpcAgreementService {
AjaxResult deleteAgreementItem(Long agreementId);
AjaxResult deleteAgreementItem(Long agreementId,String tenantId);
AjaxResult insertAgreementItem(String title,Integer type,String content);
AjaxResult insertAgreementItem(String title,Integer type,String content,String tenantId);
AjaxResult updateAgreementItem(Long agreementId,String title,Integer type,String content);
AjaxResult updateAgreementItem(Long agreementId,String title,Integer type,String content,String tenantId);
List<XhpcAgreement> selectAgreementItems(String title, String createBy,Integer type);
List<XhpcAgreement> selectAgreementItems(String title, String createBy,Integer type,String tenantId);
XhpcAgreement selectAgreementItem(Long agreementId);
XhpcAgreement selectContent(Integer type);
XhpcAgreement selectContent(Integer type,String tenantId);
}

View File

@ -24,8 +24,8 @@ public class XhpcAgreementServiceImpl implements IXhpcAgreementService {
@Override
@Transactional
public AjaxResult deleteAgreementItem(Long agreementId) {
int res=xhpcAgreementMapper.deleteAgreementItem(agreementId);
public AjaxResult deleteAgreementItem(Long agreementId,String tenantId) {
int res=xhpcAgreementMapper.deleteAgreementItem(agreementId,tenantId);
if(res==0){
return AjaxResult.error("删除失败");
}
@ -35,7 +35,7 @@ public class XhpcAgreementServiceImpl implements IXhpcAgreementService {
@Override
@Transactional
public AjaxResult insertAgreementItem(String title, Integer type, String content) {
public AjaxResult insertAgreementItem(String title, Integer type, String content,String tenantId) {
//Ensuring parameter is valid
title=title.trim();
if(title.equals("")){
@ -53,12 +53,12 @@ public class XhpcAgreementServiceImpl implements IXhpcAgreementService {
//Ensuring the title which you wanna insert is unique.
int res1 = xhpcAgreementMapper.countSameTypeTitle(type, title);
int res1 = xhpcAgreementMapper.countSameTypeTitle(type, title,tenantId);
if (res1 != 0) {
return AjaxResult.error("此协议类型已有此标题");
}
int res2=xhpcAgreementMapper.insertAgreementItem(title, type, content);
int res2=xhpcAgreementMapper.insertAgreementItem(title, type, content,tenantId);
if(res2==0){
return AjaxResult.error("增加失败");
}
@ -68,7 +68,7 @@ public class XhpcAgreementServiceImpl implements IXhpcAgreementService {
@Override
@Transactional
public AjaxResult updateAgreementItem(Long agreementId, String title, Integer type, String content) {
public AjaxResult updateAgreementItem(Long agreementId, String title, Integer type, String content,String tenantId) {
//Ensuring parameter is valid
title=title.trim();
if(title.equals("")){
@ -85,12 +85,12 @@ public class XhpcAgreementServiceImpl implements IXhpcAgreementService {
}
XhpcAgreement xhpcAgreement=xhpcAgreementMapper.selectAgreementItem(agreementId);
if(!xhpcAgreement.getTitle().equals(title)) {
int res = xhpcAgreementMapper.countSameTypeTitle(type,title);
int res = xhpcAgreementMapper.countSameTypeTitle(type,title,tenantId);
if (res != 0) {
return AjaxResult.error("此协议类型已有此标题");
}
}
int res1=xhpcAgreementMapper.updateAgreementItem(agreementId, title, type, content);
int res1=xhpcAgreementMapper.updateAgreementItem(agreementId, title, type, content,tenantId);
if(res1==0){
return AjaxResult.error("修改失败");
}
@ -99,9 +99,9 @@ public class XhpcAgreementServiceImpl implements IXhpcAgreementService {
@Override
public List<XhpcAgreement> selectAgreementItems(String title, String createBy, Integer type) {
public List<XhpcAgreement> selectAgreementItems(String title, String createBy, Integer type,String tenantId) {
return xhpcAgreementMapper.selectAgreementItems(title, createBy, type);
return xhpcAgreementMapper.selectAgreementItems(title, createBy, type,tenantId);
}
@ -113,8 +113,8 @@ public class XhpcAgreementServiceImpl implements IXhpcAgreementService {
@Override
public XhpcAgreement selectContent(Integer type) {
public XhpcAgreement selectContent(Integer type,String tenantId) {
return xhpcAgreementMapper.selectContentType(type);
return xhpcAgreementMapper.selectContentType(type,tenantId);
}
}

View File

@ -20,22 +20,26 @@
<update id="deleteAgreementItem">
update xhpc_agreement set del_flag=1 where agreement_id=#{agreementId}
<if test="tenantId !=null and tenantId !=''">
and tenant_id =#{tenantId}
</if>
</update>
<select id="countSameTypeTitle" resultType="java.lang.Integer">
select count(agreement_id) from xhpc_agreement where type=#{type} and title=#{title} and del_flag=0
<if test="tenantId !=null and tenantId !=''">
and tenant_id =#{tenantId}
</if>
</select>
<insert id="insertAgreementItem">
insert into xhpc_agreement (title,type,content) values(#{title},#{type},#{content})
insert into xhpc_agreement (title,type,content,tenant_id) values(#{title},#{type},#{content},#{tenantId})
</insert>
<update id="updateAgreementItem">
update xhpc_agreement set title=#{title},type=#{type},content=#{content} where agreement_id=#{agreementId}
update xhpc_agreement set title=#{title},type=#{type},content=#{content} ,tenant_id=#{tenantId} where agreement_id=#{agreementId}
</update>
@ -52,6 +56,9 @@
<if test="type!=null">
and type=#{type}
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id =#{tenantId}
</if>
</select>
@ -79,6 +86,9 @@
select *
from xhpc_agreement
where type=#{type}
<if test="tenantId !=null and tenantId !=''">
and tenant_id =#{tenantId}
</if>
order by update_time desc
limit 1
</select>

View File

@ -112,16 +112,15 @@ public class XhpcPileOrderController extends BaseController {
Integer code = 500;
Long userId=0L;
Map<String, Object> map = new HashMap<>();
if(status == 1|| status == 2){
userId = update(0, remark, orderNo, 1);
map.put("userId", userId);
}
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
if(xhpcChargeOrder==null|| xhpcChargeOrder.getUserId()==null){
logger.info("桩停止回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号");
}
if(status == 1|| status == 2){
userId = update(0, remark, orderNo, 1);
map.put("userId", userId);
}
if (status == 1) {
xhpcChargeOrder.setStatus(0);
map.put("message", "停止充电成功");

View File

@ -183,5 +183,14 @@ public interface XhpcStatisticsServiceMapper {
//今日订单量
Map<String, Object> getTodayNUmber(Long operatorId, Long chargingStationId, Long chargingPileId,String tenantId);
Map<String, Object> getTodayStatusNUmber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
int getTodayNUmber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
//今日订单量
int getTodayDegreeNUmber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
//今日营收
double getTodayAmount(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
}

View File

@ -355,7 +355,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
xhpcHistoryOrder.setEndTime(xhpcChargeOrder.getEndTime());
xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc());
xhpcHistoryOrder.setEndSoc(xhpcChargeOrder.getEndSoc());
xhpcHistoryOrder.setTotalPower(xhpcChargeOrder.getChargingDegree().doubleValue());
if(xhpcChargeOrder.getChargingDegree() !=null){
xhpcHistoryOrder.setTotalPower(xhpcChargeOrder.getChargingDegree().doubleValue());
}
xhpcHistoryOrder.setType(2);
addSettlement(powerPrice, servicePrice, money, surplusPowerPrice, surplusServicePrice, xhpcChargeOrder, userId, userMessage,0,null,xhpcHistoryOrder);

View File

@ -1,6 +1,8 @@
package com.xhpc.order.service.impl;
import cn.hutool.Hutool;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.ExcelUtil;
@ -976,28 +978,209 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
Long logUserId = SecurityUtils.getUserId();
SysUser sysUser = loginUser.getSysUser();
//今日订单量
//今天时间格式 yyyy-mm-dd
String beginOfDay= DateUtil.formatDateTime(DateUtil.beginOfDay(new Date()));
String endOfDay= DateUtil.formatDateTime(DateUtil.endOfDay(new Date()));
String lastBeginOfDay = lastOrThisWeek(new Date(), 1, 1);
String lastEndOfDay = lastOrThisWeek(new Date(), 1, 2);
String weekBeginOfDay = lastOrThisWeek(new Date(), 2, 1);
String weekEndOfDay = lastOrThisWeek(new Date(), 2, 2);
Map<String ,Object> map =new HashMap<>();
if(tenantId !=null && !"".equals(tenantId)){
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
if ("01".equals(sysUser.getUserType())) {
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
//---------------------------
//今日订单量
extracted(1,operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, lastBeginOfDay, lastEndOfDay, weekBeginOfDay, weekEndOfDay, map, logOperatorId);
//今日电量
int todayDegreeNUmber = xhpcStatisticsServiceMapper.getTodayDegreeNUmber(1, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
map.put("todayDegree",todayDegreeNUmber);
//今日营收
extracted(operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, map, logOperatorId);
}else{
//查询赋值的场站
//--------
//今日订单量
extracted(2,operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, lastBeginOfDay, lastEndOfDay, weekBeginOfDay, weekEndOfDay, map, logUserId);
//今日电量
int todayDegreeNUmber = xhpcStatisticsServiceMapper.getTodayDegreeNUmber(2, logUserId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
map.put("todayDegree",todayDegreeNUmber);
//今日营收
extracted(operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, map, logUserId);
}
}else{
//今日订单量
extracted(0,operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, lastBeginOfDay, lastEndOfDay, weekBeginOfDay, weekEndOfDay, map, null);
//今日电量
int todayDegreeNUmber = xhpcStatisticsServiceMapper.getTodayDegreeNUmber(0, null, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
map.put("todayDegree",todayDegreeNUmber);
//今日营收
extracted(operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay, map, null);
}
}
//今日订电量
//今日营收
//今日充电枪状态
return null;
return map;
}
private void extracted(Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId, String beginOfDay, String endOfDay, Map<String, Object> map, Long logOperatorId) {
double t1 = xhpcStatisticsServiceMapper.getTodayAmount(1, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
double t2 = xhpcStatisticsServiceMapper.getTodayAmount(1, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.parse(beginOfDay), -1)), DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.parse(endOfDay), -1)));
Map<String, Object> map1 =new HashMap<>();
map1.put("todayAmount",t1);
map1.put("yesterdayAmount",t2);
map1.put("weekNumber",t1-t2>0?(t1-t2)/t1:(t2-t1)/t1);
map.put("todayAmount", map1);
}
private void extracted(Integer status, Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId, String beginOfDay, String endOfDay, String lastBeginOfDay, String lastEndOfDay, String weekBeginOfDay, String weekEndOfDay, Map<String, Object> map, Long logOperatorId) {
Map<String, Object> todayStatusNUmber = xhpcStatisticsServiceMapper.getTodayStatusNUmber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, beginOfDay, endOfDay);
int t1 = xhpcStatisticsServiceMapper.getTodayNUmber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, lastBeginOfDay, lastEndOfDay);
int t2 = xhpcStatisticsServiceMapper.getTodayNUmber(status, logOperatorId, operatorId, chargingStationId, chargingPileId, tenantId, weekBeginOfDay, weekEndOfDay);
todayStatusNUmber.put("weekNumber",t1-t2>0?(t1-t2)/t1:(t2-t1)/t1);
map.put("todayOrder",todayStatusNUmber);
}
/**
* 获取本周和上周的开始时间
* @param date
* @param type 1上周 2本周
* @param status 1 周一 2 周日
* @return
*/
public String lastOrThisWeek(Date date,Integer type,Integer status) {
Calendar c = getCalendar(date);
int day = c.get(Calendar.DAY_OF_WEEK);
String week = "";
//一天的开始结果2017-03-01 00:00:00
Date beginOfDay = DateUtil.beginOfDay(date);
Date endOfDay = DateUtil.endOfDay(date);
switch (day) {
case 1:
//DateUtil.
if(type==1 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -13));
}else if(type==1 && status==2){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -7));
}else if(type==2 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -6));
}else{
week = DateUtil.formatDateTime(endOfDay);
}
break;
case 2:
if(type==1 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -7));
}else if(type==1 && status==2){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -1));
}else if(type==2 && status==1){
week = DateUtil.formatDateTime(beginOfDay);
}else{
week = DateUtil.formatDateTime(endOfDay);
}
break;
case 3:
if(type==1 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -8));
}else if(type==1 && status==2){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -2));
}else if(type==2 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -1));
}else{
week = DateUtil.formatDateTime(endOfDay);
}
break;
case 4:
if(type==1 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -9));
}else if(type==1 && status==2){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -3));
}else if(type==2 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -2));
}else{
week = DateUtil.formatDateTime(endOfDay);
}
break;
case 5:
if(type==1 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -10));
}else if(type==1 && status==2){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -4));
}else if(type==2 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -3));
}else{
week = DateUtil.formatDateTime(endOfDay);
}
break;
case 6:
if(type==1 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -11));
}else if(type==1 && status==2){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -5));
}else if(type==2 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -4));
}else{
week = DateUtil.formatDateTime(endOfDay);
}
break;
case 7:
if(type==1 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -12));
}else if(type==1 && status==2){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -6));
}else if(type==2 && status==1){
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -5));
}else{
week = DateUtil.formatDateTime(endOfDay);
}
break;
}
return week;
}
public Calendar getCalendar(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c;
}
public static void main(String[] args) {
DateTime date = DateUtil.date();
DateTime dateTime = DateUtil.lastWeek();
System.out.println("dateTime:"+dateTime);
String week = "";
//一天的开始结果2017-03-01 00:00:00
Date beginOfDay = DateUtil.beginOfDay(date);
Date endOfDay = DateUtil.endOfDay(date);
System.out.println("week00:"+beginOfDay);
System.out.println("week00:"+beginOfDay);
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -9));
System.out.println("week11:"+week);
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, -3));
System.out.println("week22:"+week);
week = DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -2));
System.out.println("week33:"+week);
week = DateUtil.formatDateTime(DateUtil.offsetDay(endOfDay, 4));
System.out.println("week44:"+week);
}
}

View File

@ -925,8 +925,115 @@
select count(statistics_station_id) from xhpc_statistics_station where history_order_id=#{historyOrderId} and type=#{type}
</select>
<select id="getTodayNUmber" resultType="map">
<select id="getTodayStatusNUmber" resultType="map">
SELECT
COUNT(status) number,
status,
FROM
xhpc_charge_order
WHERE
create_time &gt;=#{beginOfDay} and create_time &lt;= #{endOfDay}
<if test="operatorId !=null">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
<if test="chargingStationId !=null">
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
group by status
</select>
<select id="getTodayNUmber" resultType="int">
SELECT
COUNT(charge_order_id) number,
FROM
xhpc_charge_order
WHERE
create_time &gt;=#{beginOfDay} and create_time &lt;= #{endOfDay}
<if test="operatorId !=null">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
<if test="chargingStationId !=null">
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="getTodayDegreeNUmber" resultType="int">
SELECT
COUNT(charging_degree) number,
FROM
xhpc_charge_order
WHERE
create_time &gt;=#{beginOfDay} and create_time &lt;= #{endOfDay}
<if test="operatorId !=null">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
<if test="chargingStationId !=null">
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="getTodayAmount" resultType="double">
SELECT
COUNT(amount_charged) number,
FROM
xhpc_charge_order
WHERE
create_time &gt;=#{beginOfDay} and create_time &lt;= #{endOfDay}
<if test="operatorId !=null">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
<if test="chargingStationId !=null">
and charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId})
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
</mapper>

View File

@ -2,11 +2,15 @@ package com.xhpc.tenant.controller;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import com.xhpc.tenant.domain.XhpcTenantDomain;
import com.xhpc.tenant.service.XhpcTenantService;
@ -14,7 +18,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@ -27,6 +33,9 @@ public class XhpcTenantController extends BaseController {
@Resource
LogUserUtils logUserUtils;
@Resource
TokenService tokenService;
@GetMapping("/getPage")
public TableDataInfo getPage(String tenantId,
@ -44,7 +53,17 @@ public class XhpcTenantController extends BaseController {
@GetMapping("/getNameList")
public R getNameList(){
return R.ok(tenantService.getNameList());
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
SysUser sysUser = loginUser.getSysUser();
if(tenantId !=null && !"".equals(tenantId)){
if(sysUser.getUserId() != UserTypeUtil.USER_ID){
return R.ok(tenantService.getNameList(tenantId));
}else{
return R.ok(tenantService.getNameList(null));
}
}
return R.ok(new ArrayList<>());
}
// 到期前15填短信通知联系人

View File

@ -11,7 +11,7 @@ public interface XhpcTenantMapper {
List<XhpcTenantDomain> getList(@Param("params") Map params);
List<Map<String, Object>> getNameList();
List<Map<String, Object>> getNameList(@Param("tenantId")String tenantId);
int deleteByPrimaryKey(String tenantId);

View File

@ -10,7 +10,7 @@ public interface XhpcTenantService {
List<XhpcTenantDomain> getPage(Map<String, Object> params);
List<Map<String, Object>> getNameList();
List<Map<String, Object>> getNameList(String tenantId);
XhpcTenantDomain getInfoByPk(String tenantId);

View File

@ -27,8 +27,8 @@ public class XhpcTenantServiceImpl implements XhpcTenantService {
@Override
public List<Map<String, Object>> getNameList(){
return tenantMapper.getNameList();
public List<Map<String, Object>> getNameList(String tenantId){
return tenantMapper.getNameList(tenantId);
}
@Override

View File

@ -38,19 +38,23 @@ public class XhpcTenantTask {
/**
* 提前15天通知即将到期的租户
* 提前15731天通知即将到期的租户
*/
@Scheduled(cron = "0 0 14 * * ? ")
private void ExpiringTenantSmsTask(){
extracted(15);
extracted(7);
extracted(3);
extracted(1);
}
String expireTime = DateUtil.formatDate(com.xhpc.common.util.DateUtil.addDay(new Date(), 15));
private void extracted(int time) {
String expireTime = DateUtil.formatDate(com.xhpc.common.util.DateUtil.addDay(new Date(), time));
List<XhpcTenantDomain> expireDomainList = tenantMapper.selectExpiringList(expireTime);
for(XhpcTenantDomain domain: expireDomainList){
if (StringUtils.isEmpty(domain.getContactNumber())){
continue;
}
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", domain.getContactNumber());
paramMap.put("tenantName", domain.getTenantName());

View File

@ -31,6 +31,9 @@
tenant_id as 'tenantId',
tenant_name as 'tenantName'
from xhpc_tenant where is_deleted=0 and status=1
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
</select>