Commit 4ef329b0 by manxiaoqiang

Merge remote-tracking branch 'remotes/origin/9637230e'

* remotes/origin/9637230e: (51 commits) 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
parents 0e60f9ae 9637230e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -57,15 +57,19 @@ ...@@ -57,15 +57,19 @@
<dmp.username>root</dmp.username> <dmp.username>root</dmp.username>
<dmp.password>reyun123</dmp.password> <dmp.password>reyun123</dmp.password>
<io.url>jdbc:mysql://192.168.2.57:3306/userio?characterEncoding=utf-8</io.url>
<io.username>root</io.username>
<io.password>reyun123</io.password>
<mail.host>smtp.exmail.qq.com</mail.host> <mail.host>smtp.exmail.qq.com</mail.host>
<mail.username>manager@reyun.com</mail.username> <mail.username>manar@reyun.com</mail.username>
<mail.password>Reyun123</mail.password> <mail.password>Reyun123</mail.password>
<mail.content_type>text/plain;charset\=GBK</mail.content_type> <mail.content_type>text/plain;charset\=GBK</mail.content_type>
<mail.list>zhangliang</mail.list> <mail.list>zhangliang</mail.list>
<!-- 单位是分钟--> <!-- 单位是分钟-->
<mail.valid_time>3</mail.valid_time> <mail.valid_time>3</mail.valid_time>
<report.url>http://172.31.1.122:9010</report.url> <report.url>http://10.3.20.41:9010</report.url>
<!--Redis setting--> <!--Redis setting-->
<redis.key.validtime>120</redis.key.validtime> <redis.key.validtime>120</redis.key.validtime>
...@@ -89,44 +93,48 @@ ...@@ -89,44 +93,48 @@
<!--数据源配置--> <!--数据源配置-->
<datasource.driver>com.mysql.jdbc.Driver</datasource.driver> <datasource.driver>com.mysql.jdbc.Driver</datasource.driver>
<!--//office--> <!--//office-->
<default.datasource.url>jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/manager?characterEncoding=utf-8</default.datasource.url> <default.datasource.url>jdbc:mysql://10.3.20.32:3306/manager?characterEncoding=utf-8</default.datasource.url>
<default.datasource.username>reyuntest</default.datasource.username> <default.datasource.username>root</default.datasource.username>
<default.datasource.password>reyuntest</default.datasource.password> <default.datasource.password>reyun.123</default.datasource.password>
<office.url>jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/office?characterEncoding=utf-8</office.url> <office.url>jdbc:mysql://10.3.20.32:3306/office?characterEncoding=utf-8</office.url>
<office.username>reyuntest</office.username> <office.username>root</office.username>
<office.password>reyuntest</office.password> <office.password>reyun.123</office.password>
<tkio.url>jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/trackingio_test?characterEncoding=utf-8</tkio.url> <tkio.url>jdbc:mysql://10.3.20.32:3306/trackingio_test?characterEncoding=utf-8</tkio.url>
<tkio.username>reyuntest</tkio.username> <tkio.username>root</tkio.username>
<tkio.password>reyuntest</tkio.password> <tkio.password>reyun.123</tkio.password>
<track.url>jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/track_test?characterEncoding=utf-8</track.url> <track.url>jdbc:mysql://10.3.20.32:3306/track_test?characterEncoding=utf-8</track.url>
<track.username>reyuntest</track.username> <track.username>root</track.username>
<track.password>reyuntest</track.password> <track.password>reyun.123</track.password>
<dmp.url>jdbc:mysql://10.3.20.32:3306/manager?characterEncoding=utf-8</dmp.url>
<dmp.username>root</dmp.username>
<dmp.password>reyun.123</dmp.password>
<dmp.url>jdbc:mysql://testreyun.cjxbwnaf9ore.rds.cn-northwest-1.amazonaws.com.cn:3306/manager?characterEncoding=utf-8</dmp.url> <io.url>jdbc:mysql://10.3.20.32:3306/userio?characterEncoding=utf-8</io.url>
<dmp.username>reyuntest</dmp.username> <io.username>root</io.username>
<dmp.password>reyuntest</dmp.password> <io.password>reyun.123</io.password>
<mail.host>smtp.exmail.qq.com</mail.host> <mail.host>smtp.exmail.qq.com</mail.host>
<mail.username>manxiaoqiang@reyun.com</mail.username> <mail.username>manxiaang@reyun.com</mail.username>
<mail.password>Mxq123</mail.password> <mail.password>Mxq123</mail.password>
<mail.content_type>text/plain;charset\=GBK</mail.content_type> <mail.content_type>text/plain;charset\=GBK</mail.content_type>
<mail.list>zhangliang</mail.list> <mail.list>zhangliang</mail.list>
<!-- 单位是分钟--> <!-- 单位是分钟-->
<mail.valid_time>3</mail.valid_time> <mail.valid_time>3</mail.valid_time>
<report.url>http://172.31.23.181:8003</report.url> <report.url>http://localhost:9010</report.url>
<!--Redis setting--> <!--Redis setting-->
<redis.key.validtime>120</redis.key.validtime> <redis.key.validtime>120</redis.key.validtime>
<redis.ip.requesttimes>5</redis.ip.requesttimes> <redis.ip.requesttimes>5</redis.ip.requesttimes>
<redis.ip.unknown.requesttimes>5</redis.ip.unknown.requesttimes> <redis.ip.unknown.requesttimes>5</redis.ip.unknown.requesttimes>
<redis.surl.host>172.31.23.181</redis.surl.host> <redis.surl.host>10.3.20.33</redis.surl.host>
<redis.surl.port>6379</redis.surl.port> <redis.surl.port>6379</redis.surl.port>
<redis.event.host>172.31.23.181</redis.event.host> <redis.event.host>10.3.20.33</redis.event.host>
<redis.event.port>6379</redis.event.port> <redis.event.port>6379</redis.event.port>
<redis.event.database>13</redis.event.database> <redis.event.database>13</redis.event.database>
<!--Redis setting//end--> <!--Redis setting//end-->
...@@ -174,6 +182,10 @@ ...@@ -174,6 +182,10 @@
<dmp.username>trackingio</dmp.username> <dmp.username>trackingio</dmp.username>
<dmp.password>trackingio</dmp.password> <dmp.password>trackingio</dmp.password>
<io.url>jdbc:mysql://tkio.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn:3306/userio?characterEncoding=utf-8</io.url>
<io.username>reyun</io.username>
<io.password>Reyun123</io.password>
<mail.host>smtp.exmail.qq.com</mail.host> <mail.host>smtp.exmail.qq.com</mail.host>
<mail.username>manager@reyun.com</mail.username> <mail.username>manager@reyun.com</mail.username>
<mail.password>Reyun123</mail.password> <mail.password>Reyun123</mail.password>
......
...@@ -9,6 +9,8 @@ import dic.OperateObjectTypeEnum; ...@@ -9,6 +9,8 @@ import dic.OperateObjectTypeEnum;
import exception.TipException; import exception.TipException;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
...@@ -44,7 +46,7 @@ import java.util.Map; ...@@ -44,7 +46,7 @@ import java.util.Map;
@Controller @Controller
@RequestMapping("{platform}/contract") @RequestMapping("{platform}/contract")
public class ContractController { public class ContractController {
private static final Logger logger = LoggerFactory.getLogger(ContractController.class);
@Autowired @Autowired
private ContractService service; private ContractService service;
...@@ -53,14 +55,14 @@ public class ContractController { ...@@ -53,14 +55,14 @@ public class ContractController {
@ResponseBody @ResponseBody
public ResultModel findAll(@CurrentAccount User loginAccount, @PathVariable String platform, public ResultModel findAll(@CurrentAccount User loginAccount, @PathVariable String platform,
@RequestParam String startDate, @RequestParam String endDate) { @RequestParam String startDate, @RequestParam String endDate) {
return ResultModel.OK(service.findAll(startDate, endDate, platform)); return ResultModel.OK(service.findAll(loginAccount,startDate, endDate, platform));
} }
@RequestMapping(value = "export", method = RequestMethod.GET,produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @RequestMapping(value = "export", method = RequestMethod.GET,produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@ResponseBody @ResponseBody
public ResponseEntity<byte[]> export(@CurrentAccount User loginAccount, @PathVariable String platform, @RequestParam String startDate public ResponseEntity<byte[]> export(@CurrentAccount User loginAccount, @PathVariable String platform, @RequestParam String startDate
, @RequestParam String endDate, HttpServletRequest request, HttpServletResponse response) { , @RequestParam String endDate, HttpServletRequest request, HttpServletResponse response) {
List<Contract> contractList = service.findAll(startDate, endDate, platform); List<Contract> contractList = service.findAll(loginAccount, startDate, endDate, platform);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("wait", "未执行"); map.put("wait", "未执行");
map.put("executing", "执行中"); map.put("executing", "执行中");
...@@ -144,6 +146,13 @@ public class ContractController { ...@@ -144,6 +146,13 @@ public class ContractController {
return ResultModel.OK(service.checkAccount(email, platform)); return ResultModel.OK(service.checkAccount(email, platform));
} }
@RequestMapping(value = "checkTime", method = RequestMethod.GET)
@ResponseBody
public ResultModel checkTime(@RequestParam String type, @RequestParam String email,
@RequestParam String platform, @RequestParam(required = false) String product) {
return ResultModel.OK(service.checkTime(email, platform,type,product));
}
@RequestMapping(value = "find/body", method = RequestMethod.GET) @RequestMapping(value = "find/body", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResultModel findBody(@CurrentAccount User loginAccount) { public ResultModel findBody(@CurrentAccount User loginAccount) {
...@@ -162,6 +171,12 @@ public class ContractController { ...@@ -162,6 +171,12 @@ public class ContractController {
return ResultModel.OK(service.findSetmeal()); return ResultModel.OK(service.findSetmeal());
} }
@RequestMapping(value = "find/increment", method = RequestMethod.GET)
@ResponseBody
public ResultModel findIncrement(@CurrentAccount User loginAccount) {
return ResultModel.OK(service.findIncrement());
}
@RequestMapping(value = "find/rebat", method = RequestMethod.GET) @RequestMapping(value = "find/rebat", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResultModel rebat(@CurrentAccount User loginAccount, @RequestParam String product, public ResultModel rebat(@CurrentAccount User loginAccount, @RequestParam String product,
...@@ -245,5 +260,14 @@ public class ContractController { ...@@ -245,5 +260,14 @@ public class ContractController {
return ResultModel.OK(service.findPayAll(startDate, endDate, platform)); return ResultModel.OK(service.findPayAll(startDate, endDate, platform));
} }
@RequestMapping(value = "build", method = RequestMethod.POST)
@ResponseBody
public ResultModel build(@RequestBody Contract contract, HttpServletRequest request) {
// ContractSendEmailThread email = new ContractSendEmailThread(contract);
// email.start();
logger.error("tkiio---------------" + contract);
return ResultModel.OK(service.build(contract));
}
} }
...@@ -15,6 +15,7 @@ public class Account4Web { ...@@ -15,6 +15,7 @@ public class Account4Web {
private String createDs; private String createDs;
private String status; private String status;
private String packageType; private String packageType;
private Long packageTypeId;
private String pastDate; private String pastDate;
private BigInteger track; private BigInteger track;
private BigInteger io; private BigInteger io;
...@@ -30,6 +31,34 @@ public class Account4Web { ...@@ -30,6 +31,34 @@ public class Account4Web {
private Long bussinessMan; private Long bussinessMan;
private String contractStatus; private String contractStatus;
private Integer contractTime; private Integer contractTime;
private String saleName;
private Boolean pressStatus;
private String saleEamil;
private Long sale;
public Long getPackageTypeId() {
return packageTypeId;
}
public void setPackageTypeId(Long packageTypeId) {
this.packageTypeId = packageTypeId;
}
public String getSaleEamil() {
return saleEamil;
}
public void setSaleEamil(String saleEamil) {
this.saleEamil = saleEamil;
}
public Long getSale() {
return sale;
}
public void setSale(Long sale) {
this.sale = sale;
}
@Id @Id
@GeneratedValue @GeneratedValue
...@@ -216,4 +245,54 @@ public class Account4Web { ...@@ -216,4 +245,54 @@ public class Account4Web {
public void setContractTime(Integer contractTime) { public void setContractTime(Integer contractTime) {
this.contractTime = contractTime; this.contractTime = contractTime;
} }
public String getSaleName() {
return saleName;
}
public void setSaleName(String saleName) {
this.saleName = saleName;
}
public Boolean getPressStatus() {
return pressStatus;
}
public void setPressStatus(Boolean pressStatus) {
this.pressStatus = pressStatus;
}
@Override
public String toString() {
return "Account4Web{" +
"id=" + id +
", accountId=" + accountId +
", email='" + email + '\'' +
", company='" + company + '\'' +
", createDate=" + createDate +
", createDs='" + createDs + '\'' +
", status='" + status + '\'' +
", packageType='" + packageType + '\'' +
", packageTypeId=" + packageTypeId +
", pastDate='" + pastDate + '\'' +
", track=" + track +
", io=" + io +
", trackLimit=" + trackLimit +
", ioLimit=" + ioLimit +
", backTime=" + backTime +
", user='" + user + '\'' +
", tell='" + tell + '\'' +
", money=" + money +
", ioStatus=" + ioStatus +
", trackStatus=" + trackStatus +
", remStatus=" + remStatus +
", bussinessMan=" + bussinessMan +
", contractStatus='" + contractStatus + '\'' +
", contractTime=" + contractTime +
", saleName='" + saleName + '\'' +
", pressStatus=" + pressStatus +
", saleEamil='" + saleEamil + '\'' +
", sale=" + sale +
'}';
}
} }
...@@ -32,12 +32,17 @@ public class Contract { ...@@ -32,12 +32,17 @@ public class Contract {
private Long payMoney; private Long payMoney;
private Long invoice; private Long invoice;
private String createName; private String createName;
private String type;
private Long priceName;
private Boolean old;
private Long extraFlow;
private Long modifyAccount; private Long modifyAccount;
private Long createAccount; private Long createAccount;
private Date modifyTime; private Date modifyTime;
private Date createTime; private Date createTime;
private String ds; private String ds;
private Boolean virtual;
@Id @Id
@GeneratedValue @GeneratedValue
...@@ -49,6 +54,14 @@ public class Contract { ...@@ -49,6 +54,14 @@ public class Contract {
this.id = id; this.id = id;
} }
public Boolean getVirtual() {
return virtual;
}
public void setVirtual(Boolean virtual) {
this.virtual = virtual;
}
public String getProduct() { public String getProduct() {
return product; return product;
} }
...@@ -225,6 +238,39 @@ public class Contract { ...@@ -225,6 +238,39 @@ public class Contract {
this.invoice = invoice; this.invoice = invoice;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Boolean getOld() {
return old;
}
public Long getExtraFlow() {
return extraFlow;
}
public void setExtraFlow(Long extraFlow) {
this.extraFlow = extraFlow;
}
public void setOld(Boolean old) {
this.old = old;
}
@Transient
public Long getPriceName() {
return priceName;
}
public void setPriceName(Long priceName) {
this.priceName = priceName;
}
@Transient @Transient
public String getSaleName() { public String getSaleName() {
return saleName; return saleName;
......
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Created by mxq on 2018/1/17.
*/
@Entity
public class ContractIncrement {
private Long id;
private String packageName;
private String code;
private String type;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.math.BigInteger;
import java.util.Date;
@Entity
public class IOAccount4Web {
private Long id;
private Long accountId;
private String email;
private String company;
private Date createDate;
private String createDs;
private String status;
private String packageType;
private Long packageTypeId;
private String pastDate;
private BigInteger track;
private BigInteger io;
private BigInteger trackLimit;
private BigInteger ioLimit;
private Integer backTime;
private String user;
private String tell;
private Long money;
private Boolean ioStatus;
private Boolean trackStatus;
private Boolean remStatus;
private Long bussinessMan;
private String contractStatus;
private Integer contractTime;
private String saleName;
private Boolean pressStatus;
private String saleEamil;
private Long sale;
public Long getPackageTypeId() {
return packageTypeId;
}
public void setPackageTypeId(Long packageTypeId) {
this.packageTypeId = packageTypeId;
}
public String getSaleEamil() {
return saleEamil;
}
public void setSaleEamil(String saleEamil) {
this.saleEamil = saleEamil;
}
public Long getSale() {
return sale;
}
public void setSale(Long sale) {
this.sale = sale;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getPackageType() {
return packageType;
}
public void setPackageType(String packageType) {
this.packageType = packageType;
}
public String getPastDate() {
return pastDate;
}
public void setPastDate(String pastDate) {
this.pastDate = pastDate;
}
public BigInteger getTrack() {
return track;
}
public void setTrack(BigInteger track) {
this.track = track;
}
public BigInteger getIo() {
return io;
}
public void setIo(BigInteger io) {
this.io = io;
}
public BigInteger getTrackLimit() {
return trackLimit;
}
public void setTrackLimit(BigInteger trackLimit) {
this.trackLimit = trackLimit;
}
public BigInteger getIoLimit() {
return ioLimit;
}
public void setIoLimit(BigInteger ioLimit) {
this.ioLimit = ioLimit;
}
public Integer getBackTime() {
return backTime;
}
public void setBackTime(Integer backTime) {
this.backTime = backTime;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getTell() {
return tell;
}
public void setTell(String tell) {
this.tell = tell;
}
public Long getMoney() {
return money;
}
public void setMoney(Long money) {
this.money = money;
}
public Boolean getIoStatus() {
return ioStatus;
}
public void setIoStatus(Boolean ioStatus) {
this.ioStatus = ioStatus;
}
public Boolean getTrackStatus() {
return trackStatus;
}
public void setTrackStatus(Boolean trackStatus) {
this.trackStatus = trackStatus;
}
public Boolean getRemStatus() {
return remStatus;
}
public void setRemStatus(Boolean remStatus) {
this.remStatus = remStatus;
}
public Long getBussinessMan() {
return bussinessMan;
}
public void setBussinessMan(Long bussinessMan) {
this.bussinessMan = bussinessMan;
}
public String getCreateDs() {
return createDs;
}
public void setCreateDs(String createDs) {
this.createDs = createDs;
}
public String getContractStatus() {
return contractStatus;
}
public void setContractStatus(String contractStatus) {
this.contractStatus = contractStatus;
}
public Integer getContractTime() {
return contractTime;
}
public void setContractTime(Integer contractTime) {
this.contractTime = contractTime;
}
public String getSaleName() {
return saleName;
}
public void setSaleName(String saleName) {
this.saleName = saleName;
}
public Boolean getPressStatus() {
return pressStatus;
}
public void setPressStatus(Boolean pressStatus) {
this.pressStatus = pressStatus;
}
}
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* Created by mxq on 2018/4/11.
*/
@Entity
public class PressMoney {
private Long id;
private Long accountId;
private String email;
private Boolean pressStatus;
private Date modifyTime;
private String platform;
private Long user;
private String userName;
private String ds;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Boolean getPressStatus() {
return pressStatus;
}
public void setPressStatus(Boolean pressStatus) {
this.pressStatus = pressStatus;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public Long getUser() {
return user;
}
public void setUser(Long user) {
this.user = user;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDs() {
return ds;
}
public void setDs(String ds) {
this.ds = ds;
}
}
package common.repository;
import common.model.ContractBody;
import common.model.ContractIncrement;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
@Transactional
public interface ContractIncrementRepository extends JpaRepository<ContractIncrement, Long> {
@Query(value = "SELECT * from contract_increment where code = ?1", nativeQuery = true)
ContractIncrement findByCode(String code);
}
...@@ -18,17 +18,29 @@ public interface ContractRepository extends JpaRepository<Contract, Long> { ...@@ -18,17 +18,29 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value="select count(*) from contract where email = ?1 and platform = ?2",nativeQuery=true) @Query(value="select count(*) from contract where email = ?1 and platform = ?2",nativeQuery=true)
BigInteger countNumByEmail(String email, String platfrom); BigInteger countNumByEmail(String email, String platfrom);
@Query(value="select * from contract where ds >= ?1 and ds <= ?2 and platform = ?3 order by ds desc",nativeQuery=true) @Query(value="select * from contract where start_date >= ?1 and start_date <= ?2 and platform = ?3 order by ds desc",nativeQuery=true)
List<Contract> findByDs(String startDate, String endDate, String platfrom); List<Contract> findByDs(String startDate, String endDate, String platfrom);
@Query(value="select * from contract where start_date >= ?1 and start_date <= ?2 and platform = ?3 and sale in ?4 order by ds desc",nativeQuery=true)
List<Contract> findByDsAndRoile(String startDate, String endDate, String platfrom, List<Long> userids);
@Query(value="select * from contract where contract_code = ?1",nativeQuery=true) @Query(value="select * from contract where contract_code = ?1",nativeQuery=true)
Contract findByCode(String contract_code); Contract findByCode(String contract_code);
@Query(value="SELECT * from contract where platform = ?1",nativeQuery=true) @Query(value="SELECT * from contract where platform = ?1 and type = 'main'",nativeQuery=true)
List<Contract> findByPlatform(String platform); List<Contract> findByPlatform(String platform);
@Query(value="SELECT * from contract where platform = ?1 and email = ?2",nativeQuery=true) @Query(value="SELECT * from contract where platform = ?1 and email = ?2 and type = ?3",nativeQuery=true)
List<Contract> findByPlatformAndEmail(String platform, String email); List<Contract> findByPlatformAndEmail(String platform, String email, String type);
@Query(value="SELECT * from contract where platform = ?1 and email = ?2 and type = ?3 order by ds,end_date desc limit 1",nativeQuery=true)
Contract findByPlatformAndEmailLimit1(String platform, String email,String type);
@Query(value="SELECT * from contract where platform = ?1 and email = ?2 and type = ?3 and price_level = ?4 order by ds desc limit 1",nativeQuery=true)
Contract findByPlatformAndEmailAndPricelevelLimit1(String platform, String email,String type, Long priceLevel);
@Query(value="SELECT * from contract where platform = ?1 and email = ?2 and (status = 'wait' or status = 'executing') and type = 'main' order by ds desc limit 1",nativeQuery=true)
Contract findByPlatformAndEmailLimitVaild(String platform, String email);
@Query(value="SELECT * from contract where start_date = ?1 and status <> 'cancel'",nativeQuery=true) @Query(value="SELECT * from contract where start_date = ?1 and status <> 'cancel'",nativeQuery=true)
List<Contract> findByStartDate(String startDate); List<Contract> findByStartDate(String startDate);
......
package common.repository;
import common.model.Account4Web;
import common.model.IOAccount4Web;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional
public interface IOAccount4WebRepository extends JpaRepository<IOAccount4Web, Long> {
@Query(value = "SELECT * from ioaccount4web where email in ?1", nativeQuery = true)
List<IOAccount4Web> findByEmails(List<String> emails);
@Query(value = "SELECT * from ioaccount4web where past_date = ?1", nativeQuery = true)
List<IOAccount4Web> findByPast(String yesterday);
@Query(value = "SELECT * from ioaccount4web where status = '已过期' or status = '流量用尽'", nativeQuery = true)
List<IOAccount4Web> findPast();
@Query(value = "SELECT * from ioaccount4web where email = ?1", nativeQuery = true)
IOAccount4Web findByEmail(String email);
}
package common.repository;
import common.model.BackVisit;
import common.model.PressMoney;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional
public interface PressMoneyRepository extends JpaRepository<PressMoney, Long> {
@Query(value = "SELECT * from press_money where platform = ?1 and press_status is true", nativeQuery = true)
List<PressMoney> findAllPress(String platform);
@Query(value = "SELECT * from press_money where platform = ?1 and account_id = ?2 and press_status is true", nativeQuery = true)
PressMoney findOnePress(String platform, Long account);
@Query(value = "SELECT * from press_money where platform = ?1 and account_id = ?2", nativeQuery = true)
PressMoney findOne(String platform, Long account);
}
...@@ -36,6 +36,9 @@ public interface UserRepository extends JpaRepository<User, Long> { ...@@ -36,6 +36,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
@Query(value="SELECT * from `user` where role = ?1 ORDER BY role_type",nativeQuery=true) @Query(value="SELECT * from `user` where role = ?1 ORDER BY role_type",nativeQuery=true)
List<User> findAllUserByRole(Long role); List<User> findAllUserByRole(Long role);
@Query(value="SELECT * from `user` where role in ?1 ORDER BY role_type",nativeQuery=true)
List<User> findAllUserByRoles(List<Long> roles);
@Query(value="SELECT * from `user` where del_flag is not true and parent = ?1",nativeQuery=true) @Query(value="SELECT * from `user` where del_flag is not true and parent = ?1",nativeQuery=true)
List<User> findAllByParent(Long id); List<User> findAllByParent(Long id);
......
...@@ -13,11 +13,15 @@ public interface ContractService { ...@@ -13,11 +13,15 @@ public interface ContractService {
Map<String, Object> checkAccount(String email, String platfrom); Map<String, Object> checkAccount(String email, String platfrom);
Boolean checkTime(String email, String platfrom, String type, String product);
List<ContractBody> findBody(); List<ContractBody> findBody();
String getContractCode(String code); String getContractCode(String code);
List<PackageType> findSetmeal(); List findSetmeal();
//增值服务
List<ContractIncrement> findIncrement();
Double getRebat(String product, Integer level, Long money); Double getRebat(String product, Integer level, Long money);
...@@ -27,7 +31,7 @@ public interface ContractService { ...@@ -27,7 +31,7 @@ public interface ContractService {
Contract update(User loginUser, Contract resource); Contract update(User loginUser, Contract resource);
List<Contract> findAll(String startDate, String endDate, String platfrom); List<Contract> findAll(User loginAccount,String startDate, String endDate, String platfrom);
Contract findOne(String code); Contract findOne(String code);
...@@ -42,4 +46,6 @@ public interface ContractService { ...@@ -42,4 +46,6 @@ public interface ContractService {
Contract updatePay(User loginUser, ContractMoney resource); Contract updatePay(User loginUser, ContractMoney resource);
List<ContractMoney> findPayAll(String startDate, String endDate, String platform); List<ContractMoney> findPayAll(String startDate, String endDate, String platform);
}
Contract build(Contract contract);
}
\ No newline at end of file
...@@ -15,6 +15,7 @@ import office.service.BussinussManService; ...@@ -15,6 +15,7 @@ import office.service.BussinussManService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tkio.service.SalesManService; import tkio.service.SalesManService;
import userio.service.IOSalesManService;
import util.CharacterUtils; import util.CharacterUtils;
import util.CipherUtil; import util.CipherUtil;
import util.MailUtils; import util.MailUtils;
...@@ -39,6 +40,8 @@ public class UserServiceImpl implements UserService { ...@@ -39,6 +40,8 @@ public class UserServiceImpl implements UserService {
BussinussManService bussinussManService; BussinussManService bussinussManService;
@Autowired @Autowired
private SalesManService salesManService; private SalesManService salesManService;
@Autowired
private IOSalesManService ioSalesManService;
@Override @Override
public Boolean validEmail(String email) { public Boolean validEmail(String email) {
...@@ -65,9 +68,11 @@ public class UserServiceImpl implements UserService { ...@@ -65,9 +68,11 @@ public class UserServiceImpl implements UserService {
if(resource.getRole().equals(RoleEnum.SOUTH_BUSSINUSS.getKey())){ if(resource.getRole().equals(RoleEnum.SOUTH_BUSSINUSS.getKey())){
bussinussManService.create(login.getEmail(), save.getEmail(), save.getName(),"华北"); bussinussManService.create(login.getEmail(), save.getEmail(), save.getName(),"华北");
salesManService.create(login.getEmail(), save.getEmail(), save.getName()); salesManService.create(login.getEmail(), save.getEmail(), save.getName());
ioSalesManService.create(login.getEmail(), save.getEmail(), save.getName());
} else if(resource.getRole().equals(RoleEnum.NORTH_BUSSINUSS.getKey())){ } else if(resource.getRole().equals(RoleEnum.NORTH_BUSSINUSS.getKey())){
bussinussManService.create(login.getEmail(), save.getEmail(), save.getName(),"华南"); bussinussManService.create(login.getEmail(), save.getEmail(), save.getName(),"华南");
salesManService.create(login.getEmail(), save.getEmail(), save.getName()); salesManService.create(login.getEmail(), save.getEmail(), save.getName());
ioSalesManService.create(login.getEmail(), save.getEmail(), save.getName());
} }
...@@ -105,7 +110,7 @@ public class UserServiceImpl implements UserService { ...@@ -105,7 +110,7 @@ public class UserServiceImpl implements UserService {
auth.setUser(save.getId()); auth.setUser(save.getId());
Auth authSave = authRepository.save(auth); Auth authSave = authRepository.save(auth);
if(save.getRoleType().equals(RoleTypeEnum.COMMON.getKey())){ if(null != save.getRoleType() && save.getRoleType().equals(RoleTypeEnum.COMMON.getKey())){
JSONArray rootArr = JSONArray.fromObject(authSave.getAuth()); JSONArray rootArr = JSONArray.fromObject(authSave.getAuth());
List<String> authList = new ArrayList<>(); List<String> authList = new ArrayList<>();
if(ValidateUtil.isValid(rootArr)){ if(ValidateUtil.isValid(rootArr)){
......
package dic;
/**
* Created by mxq on 18/4/12.
* desc:合同状态
*/
public enum ContractStatusEnum {
WAIT("wait","未执行"),
EXECUTING("executing", "执行中"),
CANCEL("cancel", "作废"),
END("end", "已结束");
private String key;
private String value;
ContractStatusEnum(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
}
package dic;
/**
* Created by mxq on 18/4/12.
* desc:合同类型
*/
public enum ContractTypeEnum {
MAIN("main","产品基础套餐"),
INCREMENT("increment","增值服务套餐");
private String key;
private String value;
ContractTypeEnum(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
}
...@@ -10,6 +10,7 @@ public enum RoleEnum { ...@@ -10,6 +10,7 @@ public enum RoleEnum {
NORTH_BUSSINUSS(2L,"北区商务"), NORTH_BUSSINUSS(2L,"北区商务"),
SOUTH_BUSSINUSS(3L,"南区商务"); SOUTH_BUSSINUSS(3L,"南区商务");
private Long key; private Long key;
private String value; private String value;
......
...@@ -50,7 +50,8 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { ...@@ -50,7 +50,8 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
if (request.getRequestURL().indexOf("login/login") != -1 if (request.getRequestURL().indexOf("login/login") != -1
|| request.getRequestURL().indexOf("update/pwd") != -1 || request.getRequestURL().indexOf("update/pwd") != -1
|| request.getRequestURL().indexOf("user/forget") != -1 || request.getRequestURL().indexOf("user/forget") != -1
|| request.getRequestURL().indexOf("user/code") != -1){ || request.getRequestURL().indexOf("user/code") != -1
|| request.getRequestURL().indexOf("contract/build") != -1){
return true; return true;
} }
//从header中得到token //从header中得到token
......
...@@ -24,6 +24,24 @@ public class TkioAccountController { ...@@ -24,6 +24,24 @@ public class TkioAccountController {
@Autowired @Autowired
TkioAccountService tkioAccountService; TkioAccountService tkioAccountService;
//sale
@RequestMapping(value = "/findSale", method = RequestMethod.GET)
@ResponseBody
public ResultModel findSale(@CurrentAccount User loginAccount, @RequestParam(required = false) Long sale) {
return ResultModel.OK(tkioAccountService.findSale(loginAccount, sale));
}
//sale
@RequestMapping(value = "/update/sale", method = RequestMethod.PUT)
@ResponseBody
public ResultModel updateSale(@CurrentAccount User loginAccount,
@RequestParam String email, @RequestParam String accountEmail, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), accountEmail, "tkio修改销售为 " + email, request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.updateSale(email, accountEmail));
}
//客户列表 //客户列表
@RequestMapping(value = "/findAll", method = RequestMethod.GET) @RequestMapping(value = "/findAll", method = RequestMethod.GET)
@ResponseBody @ResponseBody
...@@ -64,6 +82,25 @@ public class TkioAccountController { ...@@ -64,6 +82,25 @@ public class TkioAccountController {
return ResultModel.OK(tkioAccountService.enable(loginAccount, resource)); return ResultModel.OK(tkioAccountService.enable(loginAccount, resource));
} }
//关闭缴费提醒
@RequestMapping(value = "/forbidenpress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel forbidenPress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "关闭缴费状态跟进", request,loginAccount.getRole());
userlog.start();
tkioAccountService.forbidenPress(loginAccount, resource);
return ResultModel.OK();
}
//开启缴费提醒
@RequestMapping(value = "/enablepress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enablePress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "开启缴费状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.enablePress(loginAccount, resource));
}
//缴费 //缴费
@RequestMapping(value = "/pay", method = RequestMethod.PUT) @RequestMapping(value = "/pay", method = RequestMethod.PUT)
@ResponseBody @ResponseBody
......
...@@ -68,6 +68,15 @@ public class Account { ...@@ -68,6 +68,15 @@ public class Account {
private Boolean isFlowRestrict; private Boolean isFlowRestrict;
private String modifyPricelevelTime; private String modifyPricelevelTime;
private Boolean newContract; private Boolean newContract;
private Boolean startByContract;
public Boolean getStartByContract() {
return startByContract;
}
public void setStartByContract(Boolean startByContract) {
this.startByContract = startByContract;
}
public Boolean getFlowRestrict() { public Boolean getFlowRestrict() {
return isFlowRestrict; return isFlowRestrict;
......
package tkio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.HashMap;
@Entity
public class Crowd {
private Long id;
private Boolean hobbyLabel;
private Boolean payLabel;
private Boolean weights;
private String dataRange;
private String iosAppkey;
private String androidAppKey;
private Long rootAccount;
private Integer status;
private Date createTime;
private String iosAppName;
private String androidAppName;
private Integer payment;
private Long applyAccount;
private HashMap<String, Object> map;
private Long deviceid_cnt;
private Double price;
private Double total;
private String contractCode;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Boolean getHobbyLabel() {
return hobbyLabel;
}
public void setHobbyLabel(Boolean hobbyLabel) {
this.hobbyLabel = hobbyLabel;
}
public Boolean getPayLabel() {
return payLabel;
}
public void setPayLabel(Boolean payLabel) {
this.payLabel = payLabel;
}
public Boolean getWeights() {
return weights;
}
public void setWeights(Boolean weights) {
this.weights = weights;
}
public String getDataRange() {
return dataRange;
}
public void setDataRange(String dataRange) {
this.dataRange = dataRange;
}
public String getIosAppkey() {
return iosAppkey;
}
public void setIosAppkey(String iosAppkey) {
this.iosAppkey = iosAppkey;
}
public String getAndroidAppKey() {
return androidAppKey;
}
public void setAndroidAppKey(String androidAppKey) {
this.androidAppKey = androidAppKey;
}
public Long getRootAccount() {
return rootAccount;
}
public void setRootAccount(Long rootAccount) {
this.rootAccount = rootAccount;
}
public Long getApplyAccount() {
return applyAccount;
}
public void setApplyAccount(Long applyAccount) {
this.applyAccount = applyAccount;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getIosAppName() {
return iosAppName;
}
public void setIosAppName(String iosAppName) {
this.iosAppName = iosAppName;
}
public String getAndroidAppName() {
return androidAppName;
}
public void setAndroidAppName(String androidAppName) {
this.androidAppName = androidAppName;
}
public Integer getPayment() {
return payment;
}
public void setPayment(Integer payment) {
this.payment = payment;
}
@Transient
public HashMap<String, Object> getMap() {
return map;
}
public void setMap(HashMap<String, Object> map) {
this.map = map;
}
@Transient
public Long getDeviceid_cnt() {
return deviceid_cnt;
}
public void setDeviceid_cnt(Long deviceid_cnt) {
this.deviceid_cnt = deviceid_cnt;
}
@Transient
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
@Transient
public Double getTotal() {
return total;
}
public void setTotal(Double total) {
this.total = total;
}
public String getContractCode() {
return contractCode;
}
public void setContractCode(String contractCode) {
this.contractCode = contractCode;
}
}
package tkio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
@Entity
public class IncrementFlow {
private Long id;
private Long account;
private String contractCode;
private Long flow;
private String startDate;
private String endDate;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public Long getFlow() {
return flow;
}
public void setFlow(Long flow) {
this.flow = flow;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String getContractCode() {
return contractCode;
}
public void setContractCode(String contractCode) {
this.contractCode = contractCode;
}
}
...@@ -3,6 +3,7 @@ package tkio.model; ...@@ -3,6 +3,7 @@ package tkio.model;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Transient;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
...@@ -77,6 +78,18 @@ public class PackageType { ...@@ -77,6 +78,18 @@ public class PackageType {
private Boolean platformServiceSupport; //7*24小时客户服务 private Boolean platformServiceSupport; //7*24小时客户服务
private Boolean platformCustomDataAnalysis; //专属数据分析师 private Boolean platformCustomDataAnalysis; //专属数据分析师
private String type;
@Transient
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Id @Id
@GeneratedValue @GeneratedValue
public Long getId() { public Long getId() {
......
...@@ -16,12 +16,18 @@ public interface AccountRepository extends JpaRepository<Account, Long> { ...@@ -16,12 +16,18 @@ public interface AccountRepository extends JpaRepository<Account, Long> {
@Query(value = "select root_parent from account where id=?1", nativeQuery = true) @Query(value = "select root_parent from account where id=?1", nativeQuery = true)
BigInteger findRootParentByAccountId(Long accountId); BigInteger findRootParentByAccountId(Long accountId);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and DATE_FORMAT(pub_date,'%Y-%m-%d') = ?1", nativeQuery = true)
List<Account> findRootParentsByPubDate(String date);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and past_date > ?1", nativeQuery = true) @Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and past_date > ?1", nativeQuery = true)
List<Account> findRootParentsUnPast(String today); List<Account> findRootParentsUnPast(String today);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and past_date < ?1", nativeQuery = true) @Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and past_date < ?1", nativeQuery = true)
List<Account> findRootParentsPast(String today); List<Account> findRootParentsPast(String today);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 0", nativeQuery = true)
List<Account> findRootParentsForbiden();
@Query(value = "SELECT * from account where is_super_user is true and bussinessman in ?1", nativeQuery = true) @Query(value = "SELECT * from account where is_super_user is true and bussinessman in ?1", nativeQuery = true)
List<Account> findBussnissMan(List<Integer> bussinussIds); List<Account> findBussnissMan(List<Integer> bussinussIds);
......
package tkio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import tkio.model.App;
import tkio.model.Crowd;
import java.math.BigInteger;
import java.util.List;
public interface CrowdRepository extends JpaRepository<Crowd, Long> {
@Query(value = "select * from crowd where contract_code = ?1", nativeQuery = true)
Crowd findOne(String code);
}
package tkio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import tkio.model.App;
import tkio.model.IncrementFlow;
import java.math.BigInteger;
import java.util.List;
public interface IncrementFlowRepository extends JpaRepository<IncrementFlow, Long> {
@Query(value = "select count(flow) from increment_flow where account = ?1 and end_date > ?2", nativeQuery = true)
BigInteger listByRootAccount(Long account, String ds);
@Query(value = "select * from increment_flow where contract_code = ?1", nativeQuery = true)
IncrementFlow findOne(String code);
@Query(value = "select appkey from app where account in ?1", nativeQuery = true)
List<String> findAppkeys(List<Long> accountId);
}
...@@ -8,7 +8,7 @@ import tkio.model.SalesManLeader; ...@@ -8,7 +8,7 @@ import tkio.model.SalesManLeader;
import java.util.List; import java.util.List;
@Transactional @Transactional
public interface SalesManLeaderRepository extends JpaRepository<SalesManLeader, Long> { public interface SalesManLeaderRepository extends JpaRepository<SalesManLeader, Integer> {
@Query(value = "select email from sales_man_leader where id=(select leader from sales_man_leader where id=?1)", nativeQuery = true) @Query(value = "select email from sales_man_leader where id=(select leader from sales_man_leader where id=?1)", nativeQuery = true)
String findLeaderByBussinessMan(Long bussinessMan); String findLeaderByBussinessMan(Long bussinessMan);
......
...@@ -9,6 +9,10 @@ import java.util.Map; ...@@ -9,6 +9,10 @@ import java.util.Map;
* Created by mxq on 2017/12/26. * Created by mxq on 2017/12/26.
*/ */
public interface TkioAccountService { public interface TkioAccountService {
Map<String, Object> findSale(User user, Long sale);
Account4Web updateSale(String email, String account);
List<Account4Web> findAll(User user); List<Account4Web> findAll(User user);
Account4Web findOne(String email); Account4Web findOne(String email);
...@@ -20,6 +24,12 @@ public interface TkioAccountService { ...@@ -20,6 +24,12 @@ public interface TkioAccountService {
//到期提醒开启 //到期提醒开启
Reminder enable(User user, Reminder resource); Reminder enable(User user, Reminder resource);
//催款提醒关闭
void forbidenPress(User user, PressMoney resource);
//催款提醒开启
PressMoney enablePress(User user, PressMoney resource);
//缴费 //缴费
Payment pay(User user, Payment resource); Payment pay(User user, Payment resource);
...@@ -41,4 +51,6 @@ public interface TkioAccountService { ...@@ -41,4 +51,6 @@ public interface TkioAccountService {
List<Contract> findContract(String email); List<Contract> findContract(String email);
List<ContractChange> findContractChange(String email, String startDate, String endDate); List<ContractChange> findContractChange(String email, String startDate, String endDate);
void contractPay(User loginUser, ContractMoney resource);
} }
...@@ -28,13 +28,17 @@ public class AccountServiceImpl implements AccountService { ...@@ -28,13 +28,17 @@ public class AccountServiceImpl implements AccountService {
String today = DateUtil.getBeforeDays(0); String today = DateUtil.getBeforeDays(0);
Date pubDate = DateUtil.getDate(contract.getStartDate()); Date pubDate = DateUtil.getDate(contract.getStartDate());
account.setPastDate(contract.getEndDate());
account.setNewContract(true);
account.setPubDate(pubDate); account.setPubDate(pubDate);
account.setModifyPricelevelTime(contract.getStartDate()); account.setPastDate(contract.getEndDate());
account.setPricelevel(contract.getPriceLevel());
account.setModifyTime(new Date()); account.setModifyTime(new Date());
account.setModifyAccount(0l); account.setModifyAccount(0l);
account.setPricelevel(contract.getPriceLevel()); if(account.getStartByContract()){
account.setNewContract(true);
account.setModifyPricelevelTime(contract.getStartDate());
}
if(!(contract.getEndDate().compareTo(today) < 0)){ if(!(contract.getEndDate().compareTo(today) < 0)){
account.setStatus(1); account.setStatus(1);
} }
......
package tkio.task;
import common.controller.ContractController;
import common.model.Contract;
import common.repository.ContractRepository;
import dic.ContractTypeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import tkio.model.Account;
import tkio.repository.AccountRepository;
import util.DateUtil;
import util.ValidateUtil;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mxq on 2018/4/23.
*/
public class AccountCheck {
private static final Logger logger = LoggerFactory.getLogger(AccountCheck.class);
@Autowired
AccountRepository accountRepository;
@Autowired
ContractRepository contractRepository;
public void task(){
List<Account> accountList = accountRepository.findRootParentsByPubDate(DateUtil.getBeforeDays(30));
logger.info("startDate :" + DateUtil.getBeforeDays(30));
if(ValidateUtil.isValid(accountList)){
List<Account> list = new ArrayList<>();
for(Account a: accountList){
List<Contract> contractList = contractRepository.findByPlatformAndEmail("tkio", a.getEmail(), ContractTypeEnum.MAIN.getKey());
if(null == contractList || contractList.isEmpty()){
a.setStatus(0);
list.add(a);
}
if(ValidateUtil.isValid(list)){
accountRepository.save(list);
}
}
}
}
}
...@@ -46,7 +46,11 @@ public class AccountTask { ...@@ -46,7 +46,11 @@ public class AccountTask {
public void task(){ public void task(){
logger.info("tkio task start :" + System.currentTimeMillis()); logger.info("tkio task start :" + System.currentTimeMillis());
List<SalesManLeader> SalesManLeader = salesManLeaderRepository.findAll();
Map<Long, String> saleMap = new HashMap<>();
for(SalesManLeader pt : SalesManLeader){
saleMap.put((long)pt.getId(), pt.getEmail());
}
List<PackageType> packageTypeList = packageTypeRepository.findAll(); List<PackageType> packageTypeList = packageTypeRepository.findAll();
Map<Long, String> map = new HashMap<>(); Map<Long, String> map = new HashMap<>();
for(PackageType pt : packageTypeList){ for(PackageType pt : packageTypeList){
...@@ -61,6 +65,7 @@ public class AccountTask { ...@@ -61,6 +65,7 @@ public class AccountTask {
for(Account ac : accountValidList){ for(Account ac : accountValidList){
Account4Web account4Web = new Account4Web(); Account4Web account4Web = new Account4Web();
account4Web.setAccountId(ac.getId()); account4Web.setAccountId(ac.getId());
account4Web.setPackageTypeId(ac.getPricelevel());
account4Web.setEmail(ac.getEmail()); account4Web.setEmail(ac.getEmail());
account4Web.setCompany(ac.getCompany()); account4Web.setCompany(ac.getCompany());
account4Web.setCreateDate(ac.getPubDate()); account4Web.setCreateDate(ac.getPubDate());
...@@ -69,10 +74,12 @@ public class AccountTask { ...@@ -69,10 +74,12 @@ public class AccountTask {
account4Web.setUser(ac.getName()); account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone()); account4Web.setTell(ac.getPhone());
account4Web.setBussinessMan(ac.getBussinessman()); account4Web.setBussinessMan(ac.getBussinessman());
if(saleMap.containsKey(ac.getBussinessman())){
account4Web.setSaleEamil(saleMap.get(ac.getBussinessman()));
}
try{ try{
AccountRestrict4Web restrict4Web = accountFlowRestrictService.findRestrictByAccount(ac.getId()); AccountRestrict4Web restrict4Web = accountFlowRestrictService.findRestrictByAccount(ac.getId());
account4Web.setStatus(null == restrict4Web.getIOFlowNotified() ? "已激活" : (restrict4Web.getIOFlowNotified() ? "已激活" : "流量用尽")); account4Web.setStatus(null == restrict4Web.getTrackFlowNotified() ? "已激活" : (restrict4Web.getTrackFlowNotified() ? "已激活" : "流量用尽"));
account4Web.setPackageType(restrict4Web.getPackageName()); account4Web.setPackageType(restrict4Web.getPackageName());
if (ac.getPricelevel().equals(7L) || ac.getPricelevel().equals(8L) || ac.getPricelevel().equals(5L) || ac.getPricelevel().equals(6L)){ if (ac.getPricelevel().equals(7L) || ac.getPricelevel().equals(8L) || ac.getPricelevel().equals(5L) || ac.getPricelevel().equals(6L)){
account4Web.setIo(restrict4Web.getThisMonthIOFlow()); account4Web.setIo(restrict4Web.getThisMonthIOFlow());
...@@ -82,29 +89,37 @@ public class AccountTask { ...@@ -82,29 +89,37 @@ public class AccountTask {
account4Web.setTrack(restrict4Web.getTrackTotalFlow()); account4Web.setTrack(restrict4Web.getTrackTotalFlow());
account4Web.setIoLimit(restrict4Web.getIOLimit()); account4Web.setIoLimit(restrict4Web.getIOLimit());
account4Web.setTrackLimit(restrict4Web.getTrackLimit()); account4Web.setTrackLimit(restrict4Web.getTrackLimit());
account4Web.setIoStatus(restrict4Web.getAllowBehavior()); account4Web.setIoStatus(true);
account4Web.setTrackStatus(restrict4Web.getTrackFlowNotified()); account4Web.setTrackStatus(restrict4Web.getTrackFlowNotified());
double f = 1.0; // double f = 1.0;
if((account4Web.getIo().doubleValue() != 0) && (null != account4Web.getIoLimit())){ // if((account4Web.getIo().doubleValue() != 0) && (null != account4Web.getIoLimit())){
if(account4Web.getIo().doubleValue() > account4Web.getIoLimit().doubleValue()){ // if(account4Web.getIo().doubleValue() > account4Web.getIoLimit().doubleValue()){
account4Web.setIoStatus(false); // account4Web.setIoStatus(false);
account4Web.setStatus("流量用尽"); // account4Web.setStatus("流量用尽");
}else{ // }else{
account4Web.setIoStatus(true); // account4Web.setIoStatus(true);
} // }
}else { // }else {
account4Web.setIoStatus(true); // account4Web.setIoStatus(true);
} // }
if(account4Web.getIoLimit().doubleValue() == -1){ // if(account4Web.getIoLimit().doubleValue() == -1){
account4Web.setIoStatus(true); // account4Web.setIoStatus(true);
account4Web.setStatus("已激活"); // account4Web.setStatus("已激活");
//
} // }
if(account4Web.getTrackLimit().doubleValue() == -1){ if(account4Web.getTrackLimit().doubleValue() <= 0){
account4Web.setTrackStatus(true); account4Web.setTrackStatus(true);
account4Web.setStatus("已激活"); account4Web.setStatus("已激活");
} }
// else {
// if(account4Web.getTrack().doubleValue() < account4Web.getTrackLimit().doubleValue()){
// account4Web.setStatus("已激活");
// } else{
// account4Web.setStatus("流量用尽");
// }
// }
account4Web.setIoStatus(true);
} }
list.add(account4Web); list.add(account4Web);
} catch (Exception e){ } catch (Exception e){
...@@ -126,6 +141,7 @@ public class AccountTask { ...@@ -126,6 +141,7 @@ public class AccountTask {
if(ValidateUtil.isValid(pastAccountList)){ if(ValidateUtil.isValid(pastAccountList)){
for(Account ac : pastAccountList){ for(Account ac : pastAccountList){
Account4Web account4Web = new Account4Web(); Account4Web account4Web = new Account4Web();
account4Web.setPackageTypeId(ac.getPricelevel());
account4Web.setAccountId(ac.getId()); account4Web.setAccountId(ac.getId());
account4Web.setEmail(ac.getEmail()); account4Web.setEmail(ac.getEmail());
account4Web.setCompany(ac.getCompany()); account4Web.setCompany(ac.getCompany());
...@@ -138,6 +154,34 @@ public class AccountTask { ...@@ -138,6 +154,34 @@ public class AccountTask {
account4Web.setUser(ac.getName()); account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone()); account4Web.setTell(ac.getPhone());
account4Web.setBussinessMan(ac.getBussinessman()); account4Web.setBussinessMan(ac.getBussinessman());
if(saleMap.containsKey(ac.getBussinessman())){
account4Web.setSaleEamil(saleMap.get(ac.getBussinessman()));
}
list.add(account4Web);
}
}
//禁用账号
List<Account> accountList = accountRepository.findRootParentsForbiden();
if(ValidateUtil.isValid(accountList)){
for(Account ac : accountList){
Account4Web account4Web = new Account4Web();
account4Web.setPackageTypeId(ac.getPricelevel());
account4Web.setAccountId(ac.getId());
account4Web.setEmail(ac.getEmail());
account4Web.setCompany(ac.getCompany());
account4Web.setCreateDate(ac.getPubDate());
account4Web.setStatus("已禁用");
account4Web.setPackageType(map.get(ac.getPricelevel()));
account4Web.setPastDate(ac.getPastDate());
account4Web.setIoStatus(false);
account4Web.setTrackStatus(false);
account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone());
account4Web.setBussinessMan(ac.getBussinessman());
if(saleMap.containsKey(ac.getBussinessman())){
account4Web.setSaleEamil(saleMap.get(ac.getBussinessman()));
}
list.add(account4Web); list.add(account4Web);
} }
} }
......
...@@ -58,6 +58,24 @@ public class TrackAccountController { ...@@ -58,6 +58,24 @@ public class TrackAccountController {
return ResultModel.OK(tkioAccountService.enable(loginAccount, resource)); return ResultModel.OK(tkioAccountService.enable(loginAccount, resource));
} }
//关闭缴费提醒
@RequestMapping(value = "/forbidenpress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel forbidenPress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "关闭异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.forbidenPress(loginAccount, resource));
}
//开启缴费提醒
@RequestMapping(value = "/enablepress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enablePress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "开启异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.enablePress(loginAccount, resource));
}
//缴费 //缴费
@RequestMapping(value = "/pay", method = RequestMethod.PUT) @RequestMapping(value = "/pay", method = RequestMethod.PUT)
@ResponseBody @ResponseBody
......
...@@ -19,6 +19,13 @@ public interface TrackAccountService { ...@@ -19,6 +19,13 @@ public interface TrackAccountService {
//到期提醒开启 //到期提醒开启
Reminder enable(User user, Reminder resource); Reminder enable(User user, Reminder resource);
//催款提醒关闭
PressMoney forbidenPress(User user, PressMoney resource);
//催款提醒开启
PressMoney enablePress(User user, PressMoney resource);
//缴费 //缴费
Payment pay(User user, Payment resource); Payment pay(User user, Payment resource);
......
...@@ -2,6 +2,7 @@ package track.service.impl; ...@@ -2,6 +2,7 @@ package track.service.impl;
import common.model.*; import common.model.*;
import common.repository.*; import common.repository.*;
import dic.ContractTypeEnum;
import dic.RoleEnum; import dic.RoleEnum;
import dic.RoleTypeEnum; import dic.RoleTypeEnum;
import org.apache.commons.collections4.list.TreeList; import org.apache.commons.collections4.list.TreeList;
...@@ -60,6 +61,8 @@ public class TrackAccountServiceImpl implements TrackAccountService{ ...@@ -60,6 +61,8 @@ public class TrackAccountServiceImpl implements TrackAccountService{
ContractChangeRepository contractChangeRepository; ContractChangeRepository contractChangeRepository;
@Autowired @Autowired
PackageTypeRepository packageTypeRepository; PackageTypeRepository packageTypeRepository;
@Autowired
PressMoneyRepository pressMoneyRepository;
@Override @Override
public List<TrackAccount4Web> findAll(User user) { public List<TrackAccount4Web> findAll(User user) {
...@@ -124,7 +127,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{ ...@@ -124,7 +127,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{
} else{ } else{
aw.setBackTime(0); aw.setBackTime(0);
} }
List<Contract> contractList = contractRepository.findByPlatformAndEmail("track", email); List<Contract> contractList = contractRepository.findByPlatformAndEmail("track", email, ContractTypeEnum.MAIN.getKey());
if(ValidateUtil.isValid(contractList)){ if(ValidateUtil.isValid(contractList)){
aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney()); aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney());
aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus()); aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus());
...@@ -163,6 +166,26 @@ public class TrackAccountServiceImpl implements TrackAccountService{ ...@@ -163,6 +166,26 @@ public class TrackAccountServiceImpl implements TrackAccountService{
} }
@Override @Override
public PressMoney forbidenPress(User user, PressMoney resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("track");
resource.setPressStatus(false);
resource.setDs(DateUtil.getBeforeDays(0));
return pressMoneyRepository.save(resource);
}
@Override
public PressMoney enablePress(User user, PressMoney resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("track");
resource.setPressStatus(true);
resource.setDs(DateUtil.getBeforeDays(0));
return pressMoneyRepository.save(resource);
}
@Override
public Payment pay(User user, Payment resource) { public Payment pay(User user, Payment resource) {
resource.setUser(user.getId()); resource.setUser(user.getId());
resource.setPayDate(new Date()); resource.setPayDate(new Date());
...@@ -284,7 +307,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{ ...@@ -284,7 +307,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{
typeMap.put(s.getId(), s.getPackageName()); typeMap.put(s.getId(), s.getPackageName());
} }
} }
List<Contract> contractList = contractRepository.findByPlatformAndEmail("track", email); List<Contract> contractList = contractRepository.findByPlatformAndEmail("track", email,ContractTypeEnum.MAIN.getKey());
if(ValidateUtil.isValid(contractList)){ if(ValidateUtil.isValid(contractList)){
for(Contract cm : contractList){ for(Contract cm : contractList){
cm.setSaleName(userMap.containsKey(cm.getSale()) ? userMap.get(cm.getSale()) : ""); cm.setSaleName(userMap.containsKey(cm.getSale()) ? userMap.get(cm.getSale()) : "");
......
package userio.controller;
import common.model.*;
import dic.OperateObjectTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import security.annotation.CurrentAccount;
import userio.service.IOAccountService;
import util.ResultModel;
import util.ResultStatus;
import util.UserLogThread;
import javax.servlet.http.HttpServletRequest;
/**
* Created by mxq on 2017/12/21.
*/
@Controller
@RequestMapping("io/marketing/accountmng")
public class IoAccountController {
@Autowired
IOAccountService tkioAccountService;
//sale
@RequestMapping(value = "/findSale", method = RequestMethod.GET)
@ResponseBody
public ResultModel findSale(@CurrentAccount User loginAccount, @RequestParam(required = false) Long sale) {
return ResultModel.OK(tkioAccountService.findSale(loginAccount, sale));
}
//sale
@RequestMapping(value = "/update/sale", method = RequestMethod.PUT)
@ResponseBody
public ResultModel updateSale(@CurrentAccount User loginAccount,
@RequestParam String email, @RequestParam String accountEmail, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), accountEmail, "tkio修改销售为 " + email, request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.updateSale(email, accountEmail));
}
//客户列表
@RequestMapping(value = "/findAll", method = RequestMethod.GET)
@ResponseBody
public ResultModel find(@CurrentAccount User loginAccount) {
return ResultModel.OK(tkioAccountService.findAll(loginAccount));
}
@RequestMapping(value = "/findone", method = RequestMethod.GET)
@ResponseBody
public ResultModel findOne(@CurrentAccount User loginAccount, @RequestParam String email) {
IOAccount4Web account4Web = tkioAccountService.findOne(email);
if(null == account4Web){
return ResultModel.ERROR(ResultStatus.USER_EMPTY);
}
return ResultModel.OK(account4Web);
}
@RequestMapping(value = "/find/reminderlevel", method = RequestMethod.GET)
@ResponseBody
public ResultModel findReminderlevel() {
return ResultModel.OK(tkioAccountService.findReminderlevel());
}
//关闭到期提醒
@RequestMapping(value = "/forbiden", method = RequestMethod.PUT)
@ResponseBody
public ResultModel forbiden(@CurrentAccount User loginAccount, @RequestBody Reminder resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "关闭异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.forbiden(loginAccount, resource));
}
//开启到期提醒
@RequestMapping(value = "/enable", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enable(@CurrentAccount User loginAccount, @RequestBody Reminder resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "开启异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.enable(loginAccount, resource));
}
//关闭缴费提醒
@RequestMapping(value = "/forbidenpress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel forbidenPress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "关闭异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.forbidenPress(loginAccount, resource));
}
//开启缴费提醒
@RequestMapping(value = "/enablepress", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enablePress(@CurrentAccount User loginAccount, @RequestBody PressMoney resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "开启异常状态跟进", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.enablePress(loginAccount, resource));
}
//缴费
@RequestMapping(value = "/pay", method = RequestMethod.PUT)
@ResponseBody
public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody Payment resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "缴费", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK(tkioAccountService.pay(loginAccount, resource));
}
//回访
@RequestMapping(value = "/visit", method = RequestMethod.PUT)
@ResponseBody
public ResultModel visit(@CurrentAccount User loginAccount, @RequestBody BackVisit resource, HttpServletRequest request) {
UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "回访", request,loginAccount.getRole());
userlog.start();
return ResultModel.OK( tkioAccountService.visit(loginAccount, resource));
}
//功能使用查询
@RequestMapping(value = "/find/function/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel updateName(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findFunTimes(accountId,startDate,endDate));
}
//功能使用查询
@RequestMapping(value = "/find/pv/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel pv(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findPv(accountId,startDate,endDate));
}
//到期提醒查询
@RequestMapping(value = "/find/reminder/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findRed(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findRed(accountId,startDate,endDate));
}
//回访查询
@RequestMapping(value = "/find/visit/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findVisit(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findVisit(accountId,startDate,endDate));
}
//缴费查询
@RequestMapping(value = "/find/pay/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findPay(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @RequestParam String email, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findPay(email,startDate,endDate));
}
//套餐变更查询
@RequestMapping(value = "/find/contract/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findChange(@CurrentAccount User loginAccount, @RequestParam String email, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findContract(email));
}
//合同查询
@RequestMapping(value = "/find/change/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findContract(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @RequestParam String email, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findContractChange(email,startDate,endDate));
}
}
package userio.model;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id")
@Entity
public class App {
private Long id;
@NotNull
private String name;
private String platform;
private String appGenre;
private String appGenreName;
private String gameGenre;
//private String gameCategory;
private String appkey;
private String url;
private Long account;
private boolean sync;
// private boolean isActive;
private Long origiApp;
private String bundleid;
private String token;
private String installtoken;
private boolean regedbutton;
private Date createTime = new Date();
private String createAccount;
private Date modifyTime = new Date();
private String modifyAccount;
private Boolean delFlag;
private Long installNum;
private Long registerNum;
private Boolean trackAndIoBothExhaust;
private Boolean mainAccountExpire;
private Boolean distributeTask;
private Date distributeTime;
private String tagType;
public App() {
super();
}
public App(String name, String platform, String appGenre, String gameGenre) {
this.name = name;
this.platform = platform;
this.appGenre = appGenre;
this.gameGenre = gameGenre;
}
public App(String name, String platform, String appGenre, String gameGenre,
Long account) {
this.name = name;
this.platform = platform;
this.appGenre = appGenre;
this.gameGenre = gameGenre;
this.account = account;
}
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean isActive) {
// this.isActive = isActive;
// }
public Long getAccount() {
return account;
}
public String getAppGenre() {
return appGenre;
}
@Transient
public String getAppGenreName() {
return appGenreName;
}
public void setAppGenreName(String appGenreName) {
this.appGenreName = appGenreName;
}
public String getAppkey() {
return appkey;
}
public String getGameGenre() {
return gameGenre;
}
/* @Transient
public String getGameCategory() {
return gameCategory;
}
public void setGameCategory(String gameCategory) {
this.gameCategory = gameCategory;
}*/
@Id
@GeneratedValue
public Long getId() {
return id;
}
public String getName() {
return name;
}
public String getPlatform() {
return platform;
}
public String getUrl() {
return url;
}
public boolean isSync() {
return sync;
}
public void setAccount(Long account) {
this.account = account;
}
public void setAppGenre(String appGenre) {
this.appGenre = appGenre;
}
public void setAppkey(String appkey) {
this.appkey = appkey;
}
public void setGameGenre(String gameGenre) {
this.gameGenre = gameGenre;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public void setSync(boolean sync) {
this.sync = sync;
}
public void setUrl(String url) {
this.url = url;
}
public Long getOrigiApp() {
return origiApp;
}
public void setOrigiApp(Long origiApp) {
this.origiApp = origiApp;
}
public String getBundleid() {
return bundleid;
}
public void setBundleid(String bundleid) {
this.bundleid = bundleid;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public boolean isRegedbutton() {
return regedbutton;
}
public void setRegedbutton(boolean regedbutton) {
this.regedbutton = regedbutton;
}
public String getInstalltoken() {
return installtoken;
}
public void setInstalltoken(String installtoken) {
this.installtoken = installtoken;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateAccount() {
return createAccount;
}
public void setCreateAccount(String createAccount) {
this.createAccount = createAccount;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(String modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Boolean getDelFlag() {
return delFlag;
}
public void setDelFlag(Boolean delFlag) {
this.delFlag = delFlag;
}
@Transient
public Boolean getTrackAndIoBothExhaust() {
return trackAndIoBothExhaust;
}
public void setTrackAndIoBothExhaust(Boolean trackAndIoBothExhaust) {
this.trackAndIoBothExhaust = trackAndIoBothExhaust;
}
@Transient
public Boolean getMainAccountExpire() {
return mainAccountExpire;
}
public void setMainAccountExpire(Boolean mainAccountExpire) {
this.mainAccountExpire = mainAccountExpire;
}
@Transient
public Long getInstallNum() {
return installNum;
}
public void setInstallNum(Long installNum) {
this.installNum = installNum;
}
@Transient
public Long getRegisterNum() {
return registerNum;
}
public void setRegisterNum(Long registerNum) {
this.registerNum = registerNum;
}
public Boolean getDistributeTask() {
return distributeTask;
}
public void setDistributeTask(Boolean distributeTask) {
this.distributeTask = distributeTask;
}
public Date getDistributeTime() {
return distributeTime;
}
public void setDistributeTime(Date distributeTime) {
this.distributeTime = distributeTime;
}
public String getTagType() {
return tagType;
}
public void setTagType(String tagType) {
this.tagType = tagType;
}
@Override
public String toString() {
return "App [id=" + id + ", name=" + name + ", platform=" + platform
+ ", appGenre=" + appGenre + ", gameGenre=" + gameGenre
+ ", appkey=" + appkey + ", url=" + url + ", account="
+ account + ", sync=" + sync + ", origiApp=" + origiApp
+ ", bundleid=" + bundleid + ", token=" + token
+ ", installtoken=" + installtoken + ", regedbutton="
+ regedbutton + ", createTime=" + createTime
+ ", createAccount=" + createAccount + ", modifyTime="
+ modifyTime + ", modifyAccount=" + modifyAccount
+ ", delFlag=" + delFlag + "]";
}
}
package userio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
@Entity
public class Auth {
private Long id;
private Long roleCategory;
private String controlAuth;
private Long app;
private Long account;
private boolean retentionAuth;
private boolean payAuth;
private Long createAccount;
private Date createTime;
private Date modifyTime = new Date();
private String modifyAccount;
private Boolean status;
private Boolean isNatureOpen;
private Boolean campaign;
private Boolean topAuth;
public Auth() {
super();
}
public Auth(Long id, Long roleCategory, String controlAuth,
Long app, Long account) {
super();
this.id = id;
this.roleCategory = roleCategory;
this.controlAuth = controlAuth;
this.app = app;
this.account = account;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleCategory() {
return roleCategory;
}
public void setRoleCategory(Long roleCategory) {
this.roleCategory = roleCategory;
}
public String getControlAuth() {
return controlAuth;
}
public void setControlAuth(String controlAuth) {
this.controlAuth = controlAuth;
}
public Long getApp() {
return app;
}
public void setApp(Long app) {
this.app = app;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public boolean isRetentionAuth() {
return retentionAuth;
}
public void setRetentionAuth(boolean retentionAuth) {
this.retentionAuth = retentionAuth;
}
public boolean isPayAuth() {
return payAuth;
}
public void setPayAuth(boolean payAuth) {
this.payAuth = payAuth;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(String modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public Boolean getIsNatureOpen() {
return isNatureOpen;
}
public void setIsNatureOpen(Boolean isNatureOpen) {
this.isNatureOpen = isNatureOpen;
}
public Boolean getCampaign() {
return campaign;
}
public void setCampaign(Boolean campaign) {
this.campaign = campaign;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateAccount() {
return createAccount;
}
public void setCreateAccount(Long createAccount) {
this.createAccount = createAccount;
}
public Boolean getTopAuth() {
return topAuth;
}
public void setTopAuth(Boolean topAuth) {
this.topAuth = topAuth;
}
@Override
public String toString() {
return "Auth [id=" + id + ", roleCategory=" + roleCategory
+ ", controlAuth=" + controlAuth + ", app=" + app
+ ", account=" + account + ", retentionAuth=" + retentionAuth
+ ", payAuth=" + payAuth + ", modifyTime=" + modifyTime
+ ", modifyAccount=" + modifyAccount + ", status=" + status
+ "]";
}
}
package userio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
@Entity
public class DataAuth {
private Long id;
private Long account;
private Long app;
private Long campaign;
private String campaignCode;
private Long channel;
private Boolean allCampaign;
private Date modifyTime = new Date();
private String modifyAccount;
private Boolean delFlag;
private Boolean channelPermit;//子账号渠道权限是否放开
//Transient
private List<Long> campaignList;
public DataAuth() {
super();
}
public DataAuth(Long id, Long app, Long campaign, String campaignCode,
Long channel, Boolean allCampaign, Boolean channelPermit) {
super();
this.id = id;
this.app = app;
this.campaign = campaign;
this.campaignCode = campaignCode;
this.channel = channel;
this.allCampaign = allCampaign;
this.channelPermit = channelPermit;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getApp() {
return app;
}
public void setApp(Long app) {
this.app = app;
}
public Long getCampaign() {
return campaign;
}
public void setCampaign(Long campaign) {
this.campaign = campaign;
}
public String getCampaignCode() {
return campaignCode;
}
public void setCampaignCode(String campaignCode) {
this.campaignCode = campaignCode;
}
public Long getChannel() {
return channel;
}
public void setChannel(Long channel) {
this.channel = channel;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(String modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Boolean getAllCampaign() {
return allCampaign;
}
public void setAllCampaign(Boolean allCampaign) {
this.allCampaign = allCampaign;
}
public Boolean getDelFlag() {
return delFlag;
}
public void setDelFlag(Boolean delFlag) {
this.delFlag = delFlag;
}
public Boolean getChannelPermit() {
return channelPermit;
}
public void setChannelPermit(Boolean channelPermit) {
this.channelPermit = channelPermit;
}
@Transient
public List<Long> getCampaignList() {
return campaignList;
}
public void setCampaignList(List<Long> campaignList) {
this.campaignList = campaignList;
}
}
package userio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
@Entity
public class RoleAuth {
private Long id;
private Long roleCategory;
private String auth;
private Boolean payAuth;
private Boolean retentionAuth;
private Boolean isNatureOpen;
private Boolean topAuth;
private String roleName;
private Long createAccount;
private Date createTime;
private Long modifyAccount;
private Date modifyTime;
private Boolean delFlag;
//@Transient
private List<RoleAuthDetail> roleAuthDetails;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleCategory() {
return roleCategory;
}
public void setRoleCategory(Long roleCategory) {
this.roleCategory = roleCategory;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public Boolean getPayAuth() {
return payAuth;
}
public void setPayAuth(Boolean payAuth) {
this.payAuth = payAuth;
}
public Boolean getRetentionAuth() {
return retentionAuth;
}
public void setRetentionAuth(Boolean retentionAuth) {
this.retentionAuth = retentionAuth;
}
public Boolean getIsNatureOpen() {
return isNatureOpen;
}
public void setIsNatureOpen(Boolean isNatureOpen) {
this.isNatureOpen = isNatureOpen;
}
public Boolean getTopAuth() {
return topAuth;
}
public void setTopAuth(Boolean topAuth) {
this.topAuth = topAuth;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Long getCreateAccount() {
return createAccount;
}
public void setCreateAccount(Long createAccount) {
this.createAccount = createAccount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Boolean getDelFlag() {
return delFlag;
}
public void setDelFlag(Boolean delFlag) {
this.delFlag = delFlag;
}
@Transient
public List<RoleAuthDetail> getRoleAuthDetails() {
return roleAuthDetails;
}
public void setRoleAuthDetails(List<RoleAuthDetail> roleAuthDetails) {
this.roleAuthDetails = roleAuthDetails;
}
@Override
public String toString() {
return "RoleAuth [id=" + id + ", roleCategory=" + roleCategory
+ ", auth=" + auth + "]";
}
}
package userio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Created by sunhao on 17/6/6.
* description:角色权限的详情
*/
@Entity
public class RoleAuthDetail {
private Long id;
private String auth;
private String authName;
private String parentAuth;
private int sort;
private Boolean view;
private Boolean edit;
private Long roleId;
public RoleAuthDetail() {}
public RoleAuthDetail(RoleAuthDetail roleAuthDetail) {
this.auth = roleAuthDetail.getAuth();
this.authName = roleAuthDetail.getAuthName();
this.parentAuth = roleAuthDetail.getParentAuth();
this.sort = roleAuthDetail.getSort();
this.view = roleAuthDetail.getView();
this.edit = roleAuthDetail.getEdit();
this.roleId = roleAuthDetail.getRoleId();
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public String getAuthName() {
return authName;
}
public void setAuthName(String authName) {
this.authName = authName;
}
public String getParentAuth() {
return parentAuth;
}
public void setParentAuth(String parentAuth) {
this.parentAuth = parentAuth;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public Boolean getView() {
return view;
}
public void setView(Boolean view) {
this.view = view;
}
public Boolean getEdit() {
return edit;
}
public void setEdit(Boolean edit) {
this.edit = edit;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
}
package userio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class SalesManLeader {
private int id;
private String area;
private String email;
private String name;
private int leader;
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getLeader() {
return leader;
}
public void setLeader(int leader) {
this.leader = leader;
}
}
package userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import userio.model.Account;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
@Transactional
public interface IOAccountRepository extends JpaRepository<Account, Long> {
@Query(value = "select root_parent from account where id=?1", nativeQuery = true)
BigInteger findRootParentByAccountId(Long accountId);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and past_date > ?1", nativeQuery = true)
List<Account> findRootParentsUnPast(String today);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and past_date < ?1", nativeQuery = true)
List<Account> findRootParentsPast(String today);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and DATE_FORMAT(pub_date,'%Y-%m-%d') = ?1", nativeQuery = true)
List<Account> findRootParentsByPubDate(String date);
@Query(value = "SELECT * from account where is_super_user is true and `status` = 0", nativeQuery = true)
List<Account> findRootParentsForidin();
@Query(value = "SELECT * from account where is_super_user is true and bussinessman in ?1", nativeQuery = true)
List<Account> findBussnissMan(List<Integer> bussinussIds);
@Query(value = "select * from account where root_parent = ?1", nativeQuery = true)
List<Account> findByRootParent(Long accountId);
@Query(value = "select count(*) from account where root_parent = ?1 and create_time > ?2 and create_time < ?3", nativeQuery = true)
BigInteger countByRootParent(Long accountId, String startDate, String endDate);
@Query(value = "select * from account where email = ?1", nativeQuery = true)
Account findByEmail(String email);
}
package userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import userio.model.App;
import java.math.BigInteger;
import java.util.List;
public interface IOAppRepository extends JpaRepository<App, Long>
{
@Query(value = "select * from app where account in (select id from account where parent = ?1 or id = ?1) and del_flag is not true", nativeQuery = true)
List<App> listAppByRootAccount(Long account);
@Query(value = "select count(*) from app where account in ?1 and create_time >= ?2 and create_time <= ?3", nativeQuery = true)
BigInteger countByAccount(List<Long> accountId, String startDate, String endDate);
@Query(value = "select appkey from app where account in ?1", nativeQuery = true)
List<String> findAppkeys(List<Long> accountId);
}
package userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import userio.model.DataAuth;
import java.util.List;
@Transactional
public interface IODataAuthRepository extends JpaRepository<DataAuth, Long> {
@Query(value = "select * from data_auth where account in ?1", nativeQuery = true)
List<DataAuth> findDataAuthByAccount(List<Long> account);
@Query(value = "select * from data_auth where account = ?1", nativeQuery = true)
List<DataAuth> findDataAuthByAccount(Long account);
@Query(value = "select * from data_auth where account = ?1 and app=?2", nativeQuery = true)
List<DataAuth> findDataAuthByAccountAndApp(Long account, Long app);
@Query(value = "select * from data_auth where account = ?2 and app in (select app from auth where create_account in ?1 and account = ?2)", nativeQuery = true)
List<DataAuth> findDataAuthByCreateAccount(List<Long> createAccount, Long channelAccount);
@Transactional
@Modifying
@Query(value = "delete from data_auth where account = ?1", nativeQuery = true)
void deleteAuthByAccount(Long account);
@Query(value = "select * from data_auth where app = ?1 and channel =?2 and campaign =?3", nativeQuery = true)
List<DataAuth> listDataAuthByAppChnCam(Long app, Long channel, Long campain);
Iterable<DataAuth> findByApp(Long id);
@Query(value = "select account from data_auth where app = ?1 and channel =?2 and campaign =?3", nativeQuery = true)
List<Long> listAccountByAppChnCam(Long app, Long channel, Long campain);
@Query(value = "select * from data_auth where channel =?1", nativeQuery = true)
List<DataAuth> listDataAuthByChannel(Long channel);
@Query(value = "select * from data_auth where account = ?1 and app = ?2 and all_campaign = 1", nativeQuery = true)
List<DataAuth> listByAllCampaign(Long account, Long app);
}
package userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import userio.model.PackageType;
public interface IOPackageTypeRepository extends JpaRepository<PackageType, Long> {
@Query(value = "select * from package_type where id=(select pricelevel from account where id=?1)", nativeQuery = true)
PackageType findPackageTypeByRootParent(Long rootParent);
@Query(value = "select * from package_type where id=?1", nativeQuery = true)
PackageType findPackageTypeByID(Long ID);
}
package userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import userio.model.RoleAuthDetail;
import java.util.List;
/**
* Created by sunhao on 17/6/7.
* Desc:权限详情DAO
*/
public interface IORoleAuthDetailRepository extends JpaRepository<RoleAuthDetail,Long> {
@Query(value = "select * from role_auth_detail where role_id = ?1", nativeQuery = true)
List<RoleAuthDetail> findDetailByRole(Long roleId);
@Query(value = "select * from role_auth_detail where role_id = ?1 and (view is true or edit is true)", nativeQuery = true)
List<RoleAuthDetail> findValidDetailByRole(Long roleId);
}
package userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import userio.model.RoleAuth;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
public interface IORoleAuthRepository extends JpaRepository<RoleAuth, Long> {
RoleAuth findByRoleCategory(Long id);
@Query(value = "select * from role_auth where id in ?1 ", nativeQuery = true)
List<RoleAuth> findCustomRoleList(List<Long> createAccounts);
@Query(value = "select * from role_auth where create_account in ?1 and del_flag is not true order by create_time desc ", nativeQuery = true)
List<RoleAuth> findAllCustomRoleList(List<Long> createAccounts);
@Query(value = "select count(*) from role_auth where create_account in ?1 and role_name = ?2 and del_flag is not true", nativeQuery = true)
BigInteger findByAccountAndName(List<Long> accountList, String roleName);
@Query(value = "select count(*) from role_auth where create_account in ?1 and role_category = 4 and del_flag is not true", nativeQuery = true)
BigInteger findCustomNumByAccount(List<Long> accountList);
@Transactional
@Modifying
@Query(value = "update role_auth set del_flag = true , modify_account = ?2, modify_time = ?3 where id = ?1 ", nativeQuery = true)
int deleteCustomRole(Long roleId, Long modifyAccount, Date modifyDate);
}
package userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import userio.model.SalesManLeader;
import java.util.List;
@Transactional
public interface IOSalesManLeaderRepository extends JpaRepository<SalesManLeader, Integer> {
@Query(value = "select email from sales_man_leader where id=(select leader from sales_man_leader where id=?1)", nativeQuery = true)
String findLeaderByBussinessMan(Long bussinessMan);
@Query(value = "select * from sales_man_leader where leader = (select id from sales_man_leader where email = ?1)", nativeQuery = true)
List<SalesManLeader> findByEmail(String email);
@Query(value = "select * from sales_man_leader where email = ?1", nativeQuery = true)
SalesManLeader findOneByEmail(String email);
@Query(value = "select * from sales_man_leader where email in ?1", nativeQuery = true)
List<SalesManLeader> findAllByEmails(List<String> emails);
}
package userio.service;
import common.model.Contract;
import userio.model.Account;
/**
* Created by mxq on 2018/1/23.
*/
public interface AccountIOService {
Account update(Contract contract);
Account forbiden(Contract contract);
}
package userio.service;
import common.model.*;
import java.util.List;
import java.util.Map;
/**
* Created by mxq on 2017/12/26.
*/
public interface IOAccountService {
Map<String, Object> findSale(User user, Long sale);
IOAccount4Web updateSale(String email, String account);
List<IOAccount4Web> findAll(User user);
IOAccount4Web findOne(String email);
List<ReminderLevel> findReminderlevel();
//到期提醒关闭
Reminder forbiden(User user, Reminder resource);
//到期提醒开启
Reminder enable(User user, Reminder resource);
//催款提醒关闭
PressMoney forbidenPress(User user, PressMoney resource);
//催款提醒开启
PressMoney enablePress(User user, PressMoney resource);
//缴费
Payment pay(User user, Payment resource);
//回访
BackVisit visit(User user, BackVisit resource);
//查询功能使用情况
Map<String, Integer> findFunTimes(Long account, String startDate, String endDate);
//查询功能使用情况
List<Map<String, Object>> findPv(Long account, String startDate, String endDate);
List<Reminder> findRed(Long account, String startDate, String endDate);
List<BackVisit> findVisit(Long account, String startDate, String endDate);
List<ContractMoney> findPay(String email, String startDate, String endDate);
List<Contract> findContract(String email);
List<ContractChange> findContractChange(String email, String startDate, String endDate);
void contractPay(User loginUser, ContractMoney resource);
}
package userio.service;
/**
* Created by mxq on 2018/1/2.
*/
public interface IOSalesManService {
void create(String loginEmail, String email, String name);
}
package userio.service.impl;
import common.model.Contract;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tkio.repository.AccountRepository;
import tkio.service.AccountService;
import userio.model.Account;
import userio.repository.IOAccountRepository;
import userio.service.AccountIOService;
import util.DateUtil;
import util.ValidateUtil;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by mxq on 2018/1/23.
*/
@Service
public class AccountIOServiceImpl implements AccountIOService {
@Autowired
IOAccountRepository accountRepository;
@Override
public Account update(Contract contract) {
Account account = accountRepository.findByEmail(contract.getEmail());
String today = DateUtil.getBeforeDays(0);
Date pubDate = DateUtil.getDate(contract.getStartDate());
account.setPastDate(contract.getEndDate());
account.setNewContract(true);
account.setPubDate(pubDate);
account.setModifyPricelevelTime(contract.getStartDate());
account.setModifyTime(new Date());
account.setModifyAccount(0l);
account.setPricelevel(contract.getPriceLevel());
if(!(contract.getEndDate().compareTo(today) < 0)){
account.setStatus(1);
}
Account save = accountRepository.save(account);
//修改子账号
List<Account> accountList = accountRepository.findByRootParent(account.getId());
if (ValidateUtil.isValid(accountList)){
List<Account> list = new ArrayList<>();
for(Account ac : accountList){
ac.setPastDate(contract.getEndDate());
ac.setPubDate(pubDate);
ac.setModifyPricelevelTime(contract.getStartDate());
ac.setPricelevel(contract.getPriceLevel());
list.add(ac);
}
accountRepository.save(list);
}
return save;
}
@Override
public Account forbiden(Contract contract) {
Account account = accountRepository.findByEmail(contract.getEmail());
account.setStatus(0);
return accountRepository.save(account);
}
}
package userio.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import userio.model.SalesManLeader;
import userio.repository.IOSalesManLeaderRepository;
import userio.service.IOSalesManService;
/**
* Created by mxq on 2018/1/2.
*/
@Service
public class IOSaleManServiceImpl implements IOSalesManService {
@Autowired
IOSalesManLeaderRepository salesManLeaderRepository;
@Override
public void create(String loginEmail, String email, String name) {
SalesManLeader salesManLeader = new SalesManLeader();
salesManLeader.setEmail(email);
salesManLeader.setName(name);
SalesManLeader manLeader = salesManLeaderRepository.findOneByEmail(loginEmail);
if(null != manLeader){
salesManLeader.setLeader(manLeader.getLeader());
salesManLeaderRepository.save(salesManLeader);
}else{
SalesManLeader save = salesManLeaderRepository.save(salesManLeader);
save.setLeader(save.getId());
salesManLeaderRepository.save(save);
}
}
}
package userio.task;
import common.model.Contract;
import common.repository.ContractRepository;
import dic.ContractTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import userio.model.Account;
import userio.repository.IOAccountRepository;
import util.DateUtil;
import util.ValidateUtil;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mxq on 2018/4/23.
*/
public class IOAccountCheck {
@Autowired
IOAccountRepository accountRepository;
@Autowired
ContractRepository contractRepository;
public void task(){
List<Account> accountList = accountRepository.findRootParentsByPubDate(DateUtil.getBeforeDays(30));
if(ValidateUtil.isValid(accountList)){
List<Account> list = new ArrayList<>();
for(Account a: accountList){
List<Contract> contractList = contractRepository.findByPlatformAndEmail("io", a.getEmail(), ContractTypeEnum.MAIN.getKey());
if(null == contractList){
a.setStatus(0);
list.add(a);
}
if(ValidateUtil.isValid(list)){
accountRepository.save(list);
}
}
}
}
}
package userio.task;
import common.model.IOAccount4Web;
import common.repository.IOAccount4WebRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import userio.model.Account;
import userio.model.PackageType;
import userio.model.SalesManLeader;
import userio.repository.IOAccountRepository;
import userio.repository.IOPackageTypeRepository;
import userio.repository.IOSalesManLeaderRepository;
import util.DateUtil;
import util.ValidateUtil;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by mxq on 2017/12/25.
*/
public class IOAccountTask {
private static Logger logger = LoggerFactory.getLogger(IOAccountTask.class);
@Autowired
IOAccountRepository accountRepository;
@Autowired
IOAccount4WebRepository account4WebRepository;
@Autowired
private IOPackageTypeRepository packageTypeRepository;
@Autowired
IOSalesManLeaderRepository salesManLeaderRepository;
public void task(){
logger.info("tkio task start :" + System.currentTimeMillis());
//清空前一天数据
account4WebRepository.deleteAll();
List<IOAccount4Web> list = new ArrayList<>();
//已过期的直接设置成过期
List<Account> pastAccountList = accountRepository.findRootParentsPast(DateUtil.getBeforeDays(0));
list.addAll(transform(pastAccountList, "已过期"));
//未过期
List<Account> unpastAccountList = accountRepository.findRootParentsUnPast(DateUtil.getBeforeDays(0));
list.addAll(transform(unpastAccountList, "已激活"));
List<Account> forbidenList = accountRepository.findRootParentsForidin();
list.addAll(transform(forbidenList, "已禁用"));
account4WebRepository.save(list);
logger.info("tkio task end :" + System.currentTimeMillis());
}
List<IOAccount4Web> transform(List<Account> accounts, String status){
List<SalesManLeader> SalesManLeader = salesManLeaderRepository.findAll();
Map<Long, String> saleMap = new HashMap<>();
for(SalesManLeader pt : SalesManLeader){
saleMap.put((long)pt.getId(), pt.getEmail());
}
List<PackageType> packageTypeList = packageTypeRepository.findAll();
Map<Long, String> map = new HashMap<>();
for(PackageType pt : packageTypeList){
map.put(pt.getId(), pt.getPackageName());
}
List<IOAccount4Web> list = new ArrayList<>();
if(ValidateUtil.isValid(accounts)){
for(Account ac : accounts){
IOAccount4Web account4Web = new IOAccount4Web();
account4Web.setStatus(status);
account4Web.setPackageTypeId(ac.getPricelevel());
account4Web.setAccountId(ac.getId());
account4Web.setEmail(ac.getEmail());
account4Web.setCompany(ac.getCompany());
account4Web.setCreateDate(ac.getPubDate());
account4Web.setPackageType(map.get(ac.getPricelevel()));
account4Web.setPastDate(ac.getPastDate());
account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone());
account4Web.setBussinessMan(ac.getBussinessman());
if(saleMap.containsKey(ac.getBussinessman())){
account4Web.setSaleEamil(saleMap.get(ac.getBussinessman()));
}
list.add(account4Web);
}
}
return list;
}
}
...@@ -19,4 +19,8 @@ track.dataSource.password=${track.password} ...@@ -19,4 +19,8 @@ track.dataSource.password=${track.password}
dmp.dataSource.url=${dmp.url} dmp.dataSource.url=${dmp.url}
dmp.dataSource.username=${dmp.username} dmp.dataSource.username=${dmp.username}
dmp.dataSource.password=${dmp.password} dmp.dataSource.password=${dmp.password}
\ No newline at end of file
io.dataSource.url=${io.url}
io.dataSource.username=${io.username}
io.dataSource.password=${io.password}
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<context:component-scan base-package="common.controller" /> <context:component-scan base-package="common.controller" />
<context:component-scan base-package="track.controller" /> <context:component-scan base-package="track.controller" />
<context:component-scan base-package="tkio.controller" /> <context:component-scan base-package="tkio.controller" />
<context:component-scan base-package="userio.controller" />
<mvc:annotation-driven> <mvc:annotation-driven>
<mvc:argument-resolvers> <mvc:argument-resolvers>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<bean id="tkioAccountTask" class="tkio.task.AccountTask"></bean> <bean id="tkioAccountTask" class="tkio.task.AccountTask"></bean>
<task:scheduled-tasks> <task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)--> <!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="tkioAccountTask" method="task" cron="0 20 0 * * ?"/> <task:scheduled ref="tkioAccountTask" method="task" cron="0 32 9 * * ?"/>
</task:scheduled-tasks> </task:scheduled-tasks>
<bean id="tkioNoticeTask" class="tkio.task.NoticeTask"></bean> <bean id="tkioNoticeTask" class="tkio.task.NoticeTask"></bean>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<bean id="contractTask" class="common.task.ContractTask"></bean> <bean id="contractTask" class="common.task.ContractTask"></bean>
<task:scheduled-tasks> <task:scheduled-tasks>
<task:scheduled ref="contractTask" method="task" cron="0 28 17 * * ?"/> <task:scheduled ref="contractTask" method="task" cron="0 28 0 * * ?"/>
</task:scheduled-tasks> </task:scheduled-tasks>
<bean id="trackAccountTask" class="track.task.AccountTask"></bean> <bean id="trackAccountTask" class="track.task.AccountTask"></bean>
...@@ -45,5 +45,22 @@ ...@@ -45,5 +45,22 @@
<task:scheduled ref="SyncAppDataTask" method="syncAppDeviceNum" cron="0 11 0 * * ?"/> <task:scheduled ref="SyncAppDataTask" method="syncAppDeviceNum" cron="0 11 0 * * ?"/>
</task:scheduled-tasks> </task:scheduled-tasks>
<bean id="ioAccountTask" class="userio.task.IOAccountTask"></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="ioAccountTask" method="task" cron="0 32 9 * * ?"/>
</task:scheduled-tasks>
<bean id="ioAccountTaskCheck" class="userio.task.IOAccountCheck"></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="ioAccountTaskCheck" method="task" cron="0 10 8 * * ?"/>
</task:scheduled-tasks>
<bean id="accountTaskCheck" class="tkio.task.AccountCheck"></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="accountTaskCheck" method="task" cron="0 10 8 * * ?"/>
</task:scheduled-tasks>
</beans> </beans>
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<context:component-scan base-package="tkio" /> <context:component-scan base-package="tkio" />
<context:component-scan base-package="track" /> <context:component-scan base-package="track" />
<context:component-scan base-package="userio" />
<context:component-scan base-package="common" /> <context:component-scan base-package="common" />
<context:component-scan base-package="office" /> <context:component-scan base-package="office" />
<context:component-scan base-package="dmp" /> <context:component-scan base-package="dmp" />
...@@ -80,6 +81,11 @@ ...@@ -80,6 +81,11 @@
<property name="username" value="${dmp.dataSource.username}"/> <property name="username" value="${dmp.dataSource.username}"/>
<property name="password" value="${dmp.dataSource.password}"/> <property name="password" value="${dmp.dataSource.password}"/>
</bean> </bean>
<bean id="ioDataSource" parent="parentDataSource">
<property name="url" value="${io.dataSource.url}"/>
<property name="username" value="${io.dataSource.username}"/>
<property name="password" value="${io.dataSource.password}"/>
</bean>
<!-- JPA实体管理工厂的配置 --> <!-- JPA实体管理工厂的配置 -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
...@@ -173,6 +179,25 @@ ...@@ -173,6 +179,25 @@
</props> </props>
</property> </property>
</bean> </bean>
<bean id="ioEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="ioDataSource"/>
<property name="packagesToScan" value="userio.model"></property>
<property name="persistenceUnitName" value="ioUnit" />
<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter"/>
<property name="jpaProperties">
<props>
<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop><!-- none -->
<prop key="hibernate.connection.CharSet">utf8</prop>
<prop key="hibernate.connection.characterEncoding">utf8</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
</props>
</property>
</bean>
<!--指定实现JPA的适配器 --> <!--指定实现JPA的适配器 -->
<bean id="hibernateJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <bean id="hibernateJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect"/> <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect"/>
...@@ -194,6 +219,9 @@ ...@@ -194,6 +219,9 @@
<bean id="dmpTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <bean id="dmpTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="dmpEntityManagerFactory"/> <property name="entityManagerFactory" ref="dmpEntityManagerFactory"/>
</bean> </bean>
<bean id="ioTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="ioEntityManagerFactory"/>
</bean>
<!-- Spring Data Jpa配置 --> <!-- Spring Data Jpa配置 -->
<jpa:repositories base-package="common.repository" <jpa:repositories base-package="common.repository"
...@@ -211,6 +239,9 @@ ...@@ -211,6 +239,9 @@
<jpa:repositories base-package="dmp.repository" <jpa:repositories base-package="dmp.repository"
repository-impl-postfix="Impl" transaction-manager-ref="dmpTransactionManager" repository-impl-postfix="Impl" transaction-manager-ref="dmpTransactionManager"
entity-manager-factory-ref="dmpEntityManagerFactory"/> entity-manager-factory-ref="dmpEntityManagerFactory"/>
<jpa:repositories base-package="userio.repository"
repository-impl-postfix="Impl" transaction-manager-ref="ioTransactionManager"
entity-manager-factory-ref="ioEntityManagerFactory"/>
<!-- 使用annotation定义事务 --> <!-- 使用annotation定义事务 -->
...@@ -219,6 +250,7 @@ ...@@ -219,6 +250,7 @@
<tx:annotation-driven transaction-manager="tkioTransactionManager" proxy-target-class="true"/> <tx:annotation-driven transaction-manager="tkioTransactionManager" proxy-target-class="true"/>
<tx:annotation-driven transaction-manager="trackTransactionManager" proxy-target-class="true"/> <tx:annotation-driven transaction-manager="trackTransactionManager" proxy-target-class="true"/>
<tx:annotation-driven transaction-manager="dmpTransactionManager" proxy-target-class="true"/> <tx:annotation-driven transaction-manager="dmpTransactionManager" proxy-target-class="true"/>
<tx:annotation-driven transaction-manager="ioTransactionManager" proxy-target-class="true"/>
<tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes> <tx:attributes>
...@@ -266,6 +298,15 @@ ...@@ -266,6 +298,15 @@
<tx:method name="*" propagation="REQUIRED"/> <tx:method name="*" propagation="REQUIRED"/>
</tx:attributes> </tx:attributes>
</tx:advice> </tx:advice>
<tx:advice id="ioTxAdvice" transaction-manager="ioTransactionManager">
<tx:attributes>
<tx:method name="report*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="list*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="query*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config expose-proxy="true"> <aop:config expose-proxy="true">
<aop:pointcut id="txPointcut" expression="execution(* common.service.*.*(..))"/> <aop:pointcut id="txPointcut" expression="execution(* common.service.*.*(..))"/>
...@@ -283,6 +324,10 @@ ...@@ -283,6 +324,10 @@
<aop:pointcut id="tracktxPointcut" expression="execution(* track.service.*.*(..))"/> <aop:pointcut id="tracktxPointcut" expression="execution(* track.service.*.*(..))"/>
<aop:advisor advice-ref="trackTxAdvice" pointcut-ref="tracktxPointcut"/> <aop:advisor advice-ref="trackTxAdvice" pointcut-ref="tracktxPointcut"/>
</aop:config> </aop:config>
<aop:config expose-proxy="true">
<aop:pointcut id="iotxPointcut" expression="execution(* userio.service.*.*(..))"/>
<aop:advisor advice-ref="ioTxAdvice" pointcut-ref="iotxPointcut"/>
</aop:config>
<!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 --> <!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment