Commit 10b70fa7 authored by jiaorz's avatar jiaorz

添加积分消息队列接口

parent 19982bfd
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-auth</artifactId> <artifactId>ace-auth</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-auth</artifactId> <artifactId>ace-auth</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-auth</artifactId> <artifactId>ace-auth</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-security</artifactId> <artifactId>ace-security</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -42,3 +42,10 @@ ALIPAY_PID=2088531634846583 ...@@ -42,3 +42,10 @@ ALIPAY_PID=2088531634846583
ALIPAY_PUBLIC_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj/EMaAD2iJP3I5M0g6pssDDe3RxF5I3ECM/Kz/btM0RiW2g5oRrHSjtGuos9l1QhQAY0SrVqa2eZdPKUB3ZqJdimQiXr3dbiMvG9UCs8vVUcrtCHCBjDllKQLiYzboxE6JLXyfII5tIXbFKiGyiEyXQnffUhQ9uGyT2EGWGecz6PLIjDdbwpxuzF2gIUzV3bPxb+0axejBxJ/3zKnWrsbyq2nvs8XrzrR2CEggNqgqsKzaacCL1yZjXzQRseSnCMtgSxR5W5afbdY0zqbUlLHUrUZ8ycCRC0ECuI9HyTbuqtdWHEZH7vIH44wEQWZPDRhMfMZvzmPUgpTWZLv5BtaQIDAQAB ALIPAY_PUBLIC_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj/EMaAD2iJP3I5M0g6pssDDe3RxF5I3ECM/Kz/btM0RiW2g5oRrHSjtGuos9l1QhQAY0SrVqa2eZdPKUB3ZqJdimQiXr3dbiMvG9UCs8vVUcrtCHCBjDllKQLiYzboxE6JLXyfII5tIXbFKiGyiEyXQnffUhQ9uGyT2EGWGecz6PLIjDdbwpxuzF2gIUzV3bPxb+0axejBxJ/3zKnWrsbyq2nvs8XrzrR2CEggNqgqsKzaacCL1yZjXzQRseSnCMtgSxR5W5afbdY0zqbUlLHUrUZ8ycCRC0ECuI9HyTbuqtdWHEZH7vIH44wEQWZPDRhMfMZvzmPUgpTWZLv5BtaQIDAQAB
ALIPAY_ACOUNT=xxfc810@163.com ALIPAY_ACOUNT=xxfc810@163.com
ALIPAY_PRIVATE_KEY=MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC3bANag6my6pjHWqwnSCffRonvOXE6uQgNNb+V23PV55zfcuC+jIgl9BRrIf4tax5f2itfDmlOdAX6mK8WJ620SHg777Q2KlgNTa25ta3xiEfgkb01SX9VyiaLPpP2TEo5LhhRcT+cUomIufQbVbm/jS8mRQ0qBoofbMfr7n9fBSiVDx/QX07qcJTc/MGCy79H5gUiy2fTOEMhTuNtPkoU3az7jXMQ5U/33ILFAJzPCMNJvQnCYxs/y5loxxHdVqV8FnuCWGEWNViuuBtFRVRNXkrs/x99nF0V5/FHnOZzdM3SWrKCpA/52G5QQrbhZXUhMyCs9stXvH+iVUC1JJ9DAgMBAAECggEAOGRf/5MdOGHCCQCKjyUzBQVV4RPDCS/cFtughH1M9sXXyCc0i8D/FtQc9vcjg2k8lHGqBfaTT8iCEhKhOemHETd6p8rBmCmamrR4JfGCghDJMHT+PATVvlWBViwuJ3o7E6tlVJzB1tjVahDpyQGpMwhAJ77xFiueiZzTNmlEBb02ByCG95vkBV7NQT8yO9/1i3eq/tMoY7FfJP5O4LQ41RmqU9TVaAnTfuE6gs5hJboNGbmSMs2w2M0tldibmWcsQsFFPLwbUz042czSVb9J7lsGJjCtsaBeUiJ15y66W9D3587JJar9p+EyA2LNbolgrrNi2AA9KU5wEW2w8XyoOQKBgQDZamXDQZK3N5E46Hp/79o0Q99jqj9sL/HCYB4+Z8dG/Mgs43HHpgd+gHVeSOgxXS7RxsLyjCsM97ysWk7sbafvqtsnYmPU2MzumykVVpgWO6dpBcwmf2Ygk2i2W77oEqIi2IUmzkvDhw9C8A8/oh+IuoyRouPGRHpykAF+uXKVhwKBgQDX+TfQDDPniSnA9kTlW5I44glRgogA4xJtAYLtEr2fH9Pys+lkOyRqQH5wbJVj27jzJ0lffNyyMxgbZ8KRiH+3qRa8wNazwwXlXmj4DQWZedkULOpgMdU4EbbkTQRU3onEpMAZhAmVvAV1KTozs4RKi+1fFZ9V6ZOtmvapNJuXZQKBgQC7Xb0rQ3SMHwAxGfCQFwVma2O2AX883iisCaemwkrze1+Lh8uDcisdMtlzEsO/3v09XdydqHxlZY6cvgssJ+hFXGoXi+xa/yfFLcR/FixlZK2Gja99MeeyhTcFiRWB7KT8ALrnUXvrmpZlanrJrQ8eBx6jV8ySDmu0FTSkoG8GOwKBgE5toxX7CHJBPhdjlvtPOJdNhiLCaw8fZpaNIPVkg9WgIkCVkuCiFYQ8LW44EDv2E4DBOITje+V+Zne1Q1PEJNUWIzqiMJWQ8bgsg6PoXqswM2N/OBF8pzg4PplDWppTQeZWCah6aVylrbmxIgCaZSUJEUchO/5f1xAJIR+rCgF9AoGBAKJVVbrKPWshQ4cTL6VzanowjpWCRUDR22Oz3nKIdRl1FX+DTXYE4Dwl38iiNHOJptS7VjU553BUZl7HxCmSBWUmtnV78NNnRKrFVUhQhIRYBjMn1W6MD0jlBkky6yXmXkPtlqU6vU19RzGrvv6fDdBf6v4AkD8kWXiH5j4XEiQS ALIPAY_PRIVATE_KEY=MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC3bANag6my6pjHWqwnSCffRonvOXE6uQgNNb+V23PV55zfcuC+jIgl9BRrIf4tax5f2itfDmlOdAX6mK8WJ620SHg777Q2KlgNTa25ta3xiEfgkb01SX9VyiaLPpP2TEo5LhhRcT+cUomIufQbVbm/jS8mRQ0qBoofbMfr7n9fBSiVDx/QX07qcJTc/MGCy79H5gUiy2fTOEMhTuNtPkoU3az7jXMQ5U/33ILFAJzPCMNJvQnCYxs/y5loxxHdVqV8FnuCWGEWNViuuBtFRVRNXkrs/x99nF0V5/FHnOZzdM3SWrKCpA/52G5QQrbhZXUhMyCs9stXvH+iVUC1JJ9DAgMBAAECggEAOGRf/5MdOGHCCQCKjyUzBQVV4RPDCS/cFtughH1M9sXXyCc0i8D/FtQc9vcjg2k8lHGqBfaTT8iCEhKhOemHETd6p8rBmCmamrR4JfGCghDJMHT+PATVvlWBViwuJ3o7E6tlVJzB1tjVahDpyQGpMwhAJ77xFiueiZzTNmlEBb02ByCG95vkBV7NQT8yO9/1i3eq/tMoY7FfJP5O4LQ41RmqU9TVaAnTfuE6gs5hJboNGbmSMs2w2M0tldibmWcsQsFFPLwbUz042czSVb9J7lsGJjCtsaBeUiJ15y66W9D3587JJar9p+EyA2LNbolgrrNi2AA9KU5wEW2w8XyoOQKBgQDZamXDQZK3N5E46Hp/79o0Q99jqj9sL/HCYB4+Z8dG/Mgs43HHpgd+gHVeSOgxXS7RxsLyjCsM97ysWk7sbafvqtsnYmPU2MzumykVVpgWO6dpBcwmf2Ygk2i2W77oEqIi2IUmzkvDhw9C8A8/oh+IuoyRouPGRHpykAF+uXKVhwKBgQDX+TfQDDPniSnA9kTlW5I44glRgogA4xJtAYLtEr2fH9Pys+lkOyRqQH5wbJVj27jzJ0lffNyyMxgbZ8KRiH+3qRa8wNazwwXlXmj4DQWZedkULOpgMdU4EbbkTQRU3onEpMAZhAmVvAV1KTozs4RKi+1fFZ9V6ZOtmvapNJuXZQKBgQC7Xb0rQ3SMHwAxGfCQFwVma2O2AX883iisCaemwkrze1+Lh8uDcisdMtlzEsO/3v09XdydqHxlZY6cvgssJ+hFXGoXi+xa/yfFLcR/FixlZK2Gja99MeeyhTcFiRWB7KT8ALrnUXvrmpZlanrJrQ8eBx6jV8ySDmu0FTSkoG8GOwKBgE5toxX7CHJBPhdjlvtPOJdNhiLCaw8fZpaNIPVkg9WgIkCVkuCiFYQ8LW44EDv2E4DBOITje+V+Zne1Q1PEJNUWIzqiMJWQ8bgsg6PoXqswM2N/OBF8pzg4PplDWppTQeZWCah6aVylrbmxIgCaZSUJEUchO/5f1xAJIR+rCgF9AoGBAKJVVbrKPWshQ4cTL6VzanowjpWCRUDR22Oz3nKIdRl1FX+DTXYE4Dwl38iiNHOJptS7VjU553BUZl7HxCmSBWUmtnV78NNnRKrFVUhQhIRYBjMn1W6MD0jlBkky6yXmXkPtlqU6vU19RzGrvv6fDdBf6v4AkD8kWXiH5j4XEiQS
#ALIPAY_APPID=2016100100641990
#ALIPAY_PID=2088531634846583
#ALIPAY_PUBLIC_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAid9pFC4tSCYfiT6w6DpL4z3mOdShAungFXC3KK16wTfoti1ytnngveQHVHnN67hkGyGKhTP/ZCmUYKK7BahwcuJFnEx5rKuX3pNcAhW4Sigurm9bNCE2nSn2Jhq6Wjkp9MNBbVr4sBKWktjA8EhIAgfM7G0Jzlvpm2La44+4b2/iUX08paPlNMAZVV8OxjlGgOgm0FAjsO3PzYPRIqNYWZMTTcGmRQ60EQy3RsM8uKacDfWa8kPF59xuja0i17okPI7JKL+mWsLM+9ktXpr/Nflji0gPGejTr03mwZ5PIckoSqN0Q21/0Tt0vsSNIiF9/9FcgK+LaBgp1sjhnhp6LwIDAQAB
#ALIPAY_ACOUNT=xxfc810@163.com
#ALIPAY_PRIVATE_KEY=MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCJ32kULi1IJh+JPrDoOkvjPeY51KEC6eAVcLcorXrBN+i2LXK2eeC95AdUec3ruGQbIYqFM/9kKZRgorsFqHBy4kWcTHmsq5fek1wCFbhKKC6ub1s0ITadKfYmGrpaOSn0w0FtWviwEpaS2MDwSEgCB8zsbQnOW+mbYtrjj7hvb+JRfTylo+U0wBlVXw7GOUaA6CbQUCOw7c/Ng9Eio1hZkxNNwaZFDrQRDLdGwzy4ppwN9ZryQ8Xn3G6NrSLXuiQ8jskov6Zawsz72S1emv81+WOLSA8Z6NOvTebBnk8hyShKo3RDbX/RO3S+xI0iIX3/0VyAr4toGCnWyOGeGnovAgMBAAECggEATwGCInlPo3+NJMWS9JCref23lz4cQiIpMcAUhS/cHyrdpL+oc56lxcsM1EC0WragTtfKnAgu+oPFLhcyWsyqG3tEbot4UhVGgtooqF0v7PbXwUe4mMfLlwY7spwwW5FUVJkrPfIafjM4q8+fyFFzSg6URIs7SlBrLorYafyqsNgyFf9wbSoJJgDWLqUCQXwImcAoSdeZPQK6PhZ4eG25LRB/Qd06TDq3YBHY/sBnaaACsRsBa8FeNbtZ6jIa4YKCYniWtxbpkZ4C/kz2upEen9BeSV/1Xtz7RF0vyUEBkQi0RYwMKJrZ7nI8N44AlPMaEgHLw4MbDa2CRgKOWZI7sQKBgQDAPLD2BzwDBgKKhFQ9JJ+W2HNBrFpFi4rw8UJXZpZ5YrWNPHJ/0h1EbDTQ8X7DqHFRxIKYMfD4q/VWelgdWHORuZsiKJDq8726Lh5Fh/2wsSmew9OD4LhZ1J/PDpPikmbxytI08N55+VCv9hLdGl8Ybn/rP9pKnzrNH8hfSpBJBwKBgQC3moKZMRjshfB74+VXbOtNMxUBNiXnfo4nmHIMHA4PS8MpVMi5cMZ6647WltyO+M28auhUL1Ba0MZiHUxGcTQSlU8qNA2ZOhLVB2LCUpVdLpEw4uy8sXQVNCjMZIOcrb5FGVAdSEyt6caN1FQifURq8fx5Y+faFg9Eb+mAGK5DmQKBgQCbdnmF/gPCTjHv42RcrimBzDopekDmzRroD7QfCo/WSsWYGrJePIX+t6Ne9m4VvTsnbUxP2NOPx0D5Vqe707RivT+AOF46JDPjRTil8nxvUFbgVm3P0QRFYXZ79MYUDWHDWMr2lXTWH5HpO4+1z4XoNDSvA0x93JepG3Ln3V0iMQKBgQCMWc6PsFpvJAwriJCefiJ5Rx09adkb10BvwDceTqvowW+Uvr0aFL2E5WCxZW2A1WzgJZEoGWsBoSqlgeP2zT6THhQAHP5wLVaMBjNWfK61Jo3SowV5UOV99/tgE04QjTgvtiPp3oTPRS+E59TQ8JVGc2kemmJ38fkFxc7nHvbHsQKBgDlhm1N0VCUvLKaGzgLW7e4j/13ot3OoBTwxBLhZQkWxapR8E47X91rcljP0Huac1pP5upM7mLW9i6G01Y9ounrrQ98aH/OusnObDDyOcZlf1Zp5QkWCAVwWGcq6AlVIGxLyeggYBu6f85x+GFgl0x53X+G7sW/PraMQ7iAJ2w47
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-control</artifactId> <artifactId>ace-control</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-security</artifactId> <artifactId>ace-security</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform</artifactId> <artifactId>xx-common-platform</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<artifactId>ace-modules</artifactId> <artifactId>ace-modules</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath></relativePath> <relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-modules</artifactId> <artifactId>ace-modules</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-modules</artifactId> <artifactId>ace-modules</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform</artifactId> <artifactId>xx-common-platform</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
......
...@@ -5,6 +5,7 @@ import lombok.Data; ...@@ -5,6 +5,7 @@ import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal; import java.math.BigDecimal;
@Table(name = "integral_rule") @Table(name = "integral_rule")
...@@ -121,7 +122,7 @@ public class IntegralRule{ ...@@ -121,7 +122,7 @@ public class IntegralRule{
private String code; private String code;
/** /**
* 获取积分规则 * 获取积分规则 如:{"rule":4} 订单金额*4
*/ */
private String regulation; private String regulation;
...@@ -131,5 +132,12 @@ public class IntegralRule{ ...@@ -131,5 +132,12 @@ public class IntegralRule{
@Column(name = "other_rule") @Column(name = "other_rule")
private String otherRule; private String otherRule;
/**
* 操作按钮文字
*/
private String btnWord;
@Transient
private Boolean integralStatus;
} }
\ No newline at end of file
...@@ -44,4 +44,12 @@ public class IntegralUserTotal { ...@@ -44,4 +44,12 @@ public class IntegralUserTotal {
*/ */
private Boolean isdel; private Boolean isdel;
public static IntegralUserTotal initIntegralUserTotal() {
IntegralUserTotal integralUserTotal = new IntegralUserTotal();
integralUserTotal.setIsdel(false);
integralUserTotal.setTotalPoint(0);
integralUserTotal.setRestPoint(0);
return integralUserTotal;
}
} }
\ No newline at end of file
package com.xxfc.platform.activity.vo;
import com.xxfc.platform.activity.entity.IntegralRule;
import lombok.Data;
@Data
public class IntegralRuleVo extends IntegralRule {
private Boolean integralStatus;
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform-web/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
......
...@@ -2,14 +2,18 @@ package com.xxfc.platform.activity.biz; ...@@ -2,14 +2,18 @@ package com.xxfc.platform.activity.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.github.wxiaoqi.security.common.vo.PageParam;
import com.xxfc.platform.activity.entity.IntegralRule; import com.xxfc.platform.activity.entity.IntegralRule;
import com.xxfc.platform.activity.entity.IntegralUserRecord;
import com.xxfc.platform.activity.mapper.IntegralRuleMapper; import com.xxfc.platform.activity.mapper.IntegralRuleMapper;
import com.xxfc.platform.activity.user.UserInfoBiz;
import com.xxfc.platform.activity.vo.IntegralRuleDto; import com.xxfc.platform.activity.vo.IntegralRuleDto;
import com.xxfc.platform.activity.vo.IntegralUserRecordDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -19,6 +23,10 @@ import java.util.List; ...@@ -19,6 +23,10 @@ import java.util.List;
@Transactional @Transactional
public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> { public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> {
@Autowired
UserInfoBiz userInfoBiz;
@Autowired
IntegralUserRecordBiz integralUserRecordBiz;
/** /**
* 添加、更新积分规则 * 添加、更新积分规则
...@@ -73,9 +81,41 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> { ...@@ -73,9 +81,41 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> {
public ObjectRestResponse<PageDataVO> getAll(IntegralRuleDto integralRule) { public ObjectRestResponse<PageDataVO> getAll(IntegralRuleDto integralRule) {
Query query = new Query(integralRule); Query query = new Query(integralRule);
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectAllByParam(integralRule)); PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectAllByParam(integralRule));
//添加个人积分状态
return ObjectRestResponse.succ(pageDataVO);
}
public ObjectRestResponse<PageDataVO> getList(IntegralRuleDto integralRule) {
AppUserDTO appUserDTO = userInfoBiz.getUserInfo();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
}
Query query = new Query(integralRule);
PageDataVO<IntegralRule> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectAllByParam(integralRule));
//添加个人积分状态
for(IntegralRule value : pageDataVO.getData()) {
value.setIntegralStatus(getIntegralStatus(appUserDTO, value));
}
return ObjectRestResponse.succ(pageDataVO); return ObjectRestResponse.succ(pageDataVO);
} }
public boolean getIntegralStatus(AppUserDTO appUserDTO, IntegralRule integralRule) {
IntegralUserRecordDto integralUserRecordDto = new IntegralUserRecordDto();
integralUserRecordDto.setUserId(appUserDTO.getUserid());
integralUserRecordDto.setIntegralRuleCode(integralRule.getCode());
List<IntegralUserRecord> integralUserRecords = integralUserRecordBiz.getByUserAndTime(integralUserRecordDto).getData();
if(integralUserRecords == null || integralUserRecords.size() <=0 ) {
return false;
} else if(integralUserRecords.size() == integralRule.getNumber()){//记录 == 规则数 代表已经完成
return true;
} else {
return false;
}
}
} }
package com.xxfc.platform.activity.biz; package com.xxfc.platform.activity.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
...@@ -10,7 +8,6 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO; ...@@ -10,7 +8,6 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.activity.entity.IntegralUserTotal; import com.xxfc.platform.activity.entity.IntegralUserTotal;
import com.xxfc.platform.activity.mapper.IntegralUserTotalMapper; import com.xxfc.platform.activity.mapper.IntegralUserTotalMapper;
import com.xxfc.platform.activity.user.UserInfoBiz; import com.xxfc.platform.activity.user.UserInfoBiz;
import com.xxfc.platform.activity.vo.IntegralRuleDto;
import com.xxfc.platform.activity.vo.IntegralUserTotalDto; import com.xxfc.platform.activity.vo.IntegralUserTotalDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -115,8 +112,13 @@ public class IntegralUserTotalBiz extends BaseBiz<IntegralUserTotalMapper, Integ ...@@ -115,8 +112,13 @@ public class IntegralUserTotalBiz extends BaseBiz<IntegralUserTotalMapper, Integ
IntegralUserTotalDto integralUserTotalDto = new IntegralUserTotalDto(); IntegralUserTotalDto integralUserTotalDto = new IntegralUserTotalDto();
integralUserTotalDto.setUserId(appUserDTO.getUserid()); integralUserTotalDto.setUserId(appUserDTO.getUserid());
List<IntegralUserTotal> oldValue = mapper.selectAllByParam(integralUserTotalDto); List<IntegralUserTotal> oldValue = mapper.selectAllByParam(integralUserTotalDto);
if(oldValue == null || oldValue.size() <=0) {
return ObjectRestResponse.succ(oldValue == null || oldValue.size() <=0 ? null : oldValue.get(0)); IntegralUserTotal integralUserTotal = IntegralUserTotal.initIntegralUserTotal();
integralUserTotal.setUserId(appUserDTO.getUserid());
insertSelective(integralUserTotal);
return ObjectRestResponse.succ(integralUserTotal);
}
return ObjectRestResponse.succ(oldValue.get(0));
} }
/** /**
......
...@@ -13,8 +13,6 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -13,8 +13,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController @RestController
@RequestMapping(value = "integralRule") @RequestMapping(value = "integralRule")
@Api(value = "积分规则") @Api(value = "积分规则")
...@@ -44,7 +42,7 @@ public class IntegralRuleController { ...@@ -44,7 +42,7 @@ public class IntegralRuleController {
@GetMapping(value = "/list") @GetMapping(value = "/list")
@ApiOperation(value = "获取所有的规则") @ApiOperation(value = "获取所有的规则")
public ObjectRestResponse<PageDataVO> getList(IntegralRuleDto integralRuleDto) { public ObjectRestResponse<PageDataVO> getList(IntegralRuleDto integralRuleDto) {
return integralRuleBiz.getAll(integralRuleDto); return integralRuleBiz.getList(integralRuleDto);
} }
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform</artifactId> <artifactId>xx-common-platform</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform-web/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform</artifactId> <artifactId>xx-common-platform</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform-web/pom.xml</relativePath>
<relativePath/> <relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>xx-common</artifactId> <artifactId>xx-common</artifactId>
<groupId>com.xxfc</groupId> <groupId>com.xxfc</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>xx-common-platform</artifactId> <artifactId>xx-common-platform</artifactId>
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../xx-common-platform/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>ace-security</artifactId> <artifactId>ace-security</artifactId>
<groupId>com.github.wxiaoqi</groupId> <groupId>com.github.wxiaoqi</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>xx-common-platform</artifactId> <artifactId>xx-common-platform</artifactId>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform</artifactId> <artifactId>xx-common-platform</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
...@@ -16,5 +17,47 @@ ...@@ -16,5 +17,47 @@
<artifactId>ace-admin-api</artifactId> <artifactId>ace-admin-api</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
</dependency> </dependency>
<!--引入开源后台项目的公共包-->
<dependency>
<groupId>com.github.wxiaoqi</groupId>
<artifactId>ace-auth-client</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<!-- 自己项目 -->
<!--mongodb-->
<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>7.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.1.14</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.xxfc.platform.im.dto;
import com.xxfc.platform.im.model.Comment;
import lombok.Data;
@Data
public class CommentVo extends Comment {
private String picUrl;
}
package com.xxfc.platform.im.dto;
import com.xxfc.platform.im.model.Praise;
import lombok.Data;
@Data
public class PraiseVo extends Praise {
private String picUrl;
}
...@@ -51,5 +51,21 @@ public class ImComment { ...@@ -51,5 +51,21 @@ public class ImComment {
@Column(name = "is_del") @Column(name = "is_del")
private Boolean isDel = false; private Boolean isDel = false;
private String nickname;
private String picUrl;
/**
* 创建时间
*/
@Column(name = "crt_time")
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
private Long updTime;
} }
\ No newline at end of file
...@@ -43,4 +43,19 @@ public class ImPraise { ...@@ -43,4 +43,19 @@ public class ImPraise {
@Column(name = "is_del") @Column(name = "is_del")
private Boolean isDel = false; private Boolean isDel = false;
private String nickname;
private String picUrl;
/**
* 创建时间
*/
@Column(name = "crt_time")
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
private Long updTime;
} }
\ No newline at end of file
...@@ -55,6 +55,17 @@ public class ImQuestion { ...@@ -55,6 +55,17 @@ public class ImQuestion {
@Column(name = "is_del") @Column(name = "is_del")
private Boolean isDel = false; private Boolean isDel = false;
/**
* 创建时间
*/
@Column(name = "crt_time")
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
private Long updTime;
/** /**
* 内容 * 内容
*/ */
...@@ -64,4 +75,8 @@ public class ImQuestion { ...@@ -64,4 +75,8 @@ public class ImQuestion {
private Integer praiseCount; private Integer praiseCount;
private String nickname;
private String picUrl;
} }
\ No newline at end of file
...@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.aliyun.oss.ServiceException; import com.aliyun.oss.ServiceException;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.xxfc.platform.im.dto.CommentVo;
import com.xxfc.platform.im.dto.PraiseVo;
import com.xxfc.platform.im.utils.DateUtil; import com.xxfc.platform.im.utils.DateUtil;
import com.xxfc.platform.im.utils.StringUtil; import com.xxfc.platform.im.utils.StringUtil;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
...@@ -34,15 +36,15 @@ public class Msg { ...@@ -34,15 +36,15 @@ public class Msg {
private Long time;// 发朋友圈消息时间 private Long time;// 发朋友圈消息时间
private Integer userId;// 发消息用户Id private Integer userId;// 发消息用户Id
private String lable;// 标签(目前用于短视频标签) private String lable;// 标签(目前用于短视频标签)
private String pic; //头像
private Integer visible=1; //是否可见(1:公开,2:私密,3:部分可见选中的朋友的可见,4:不给谁看,5:@谁看) private Integer visible=1; //是否可见(1:公开,2:私密,3:部分可见选中的朋友的可见,4:不给谁看,5:@谁看)
private List<Integer> userLook;//选中可见的朋友列表 private List<Integer> userLook;//选中可见的朋友列表
private List<Integer> userNotLook;//选中不可见的朋友列表 private List<Integer> userNotLook;//选中不可见的朋友列表
private List<Integer> userRemindLook;//@提醒朋友列表 private List<Integer> userRemindLook;//@提醒朋友列表
private @Reference List<Comment> comments;// 评论列表 private @Reference List<CommentVo> comments;// 评论列表
private @Reference List<Givegift> gifts;// 礼物列表 private @Reference List<Givegift> gifts;// 礼物列表
private @Reference List<Praise> praises;// 赞列表 private @Reference List<PraiseVo> praises;// 赞列表
private @Transient int isPraise;// 请求接口人是否赞过本条消息 0:未点赞 1:已点赞 private @Transient int isPraise;// 请求接口人是否赞过本条消息 0:未点赞 1:已点赞
private @Transient int isCollect;// 请求接口人是否收藏本条消息 0:未收藏过 1:已收藏 private @Transient int isCollect;// 请求接口人是否收藏本条消息 0:未收藏过 1:已收藏
private int state;// 是否被锁定 0:正常 1:锁定 private int state;// 是否被锁定 0:正常 1:锁定
...@@ -97,7 +99,7 @@ public class Msg { ...@@ -97,7 +99,7 @@ public class Msg {
return model; return model;
} }
public ObjectId getMsgId() { public ObjectId getId() {
return id; return id;
} }
...@@ -153,8 +155,8 @@ public class Msg { ...@@ -153,8 +155,8 @@ public class Msg {
this.model = model; this.model = model;
} }
public void setMsgId(ObjectId msgId) { public void setId(ObjectId id) {
this.id = msgId; this.id = id;
} }
public void setNickname(String nickname) { public void setNickname(String nickname) {
...@@ -197,11 +199,11 @@ public class Msg { ...@@ -197,11 +199,11 @@ public class Msg {
this.userRemindLook = userRemindLook; this.userRemindLook = userRemindLook;
} }
public List<Comment> getComments() { public List<CommentVo> getComments() {
return comments; return comments;
} }
public void setComments(List<Comment> comments) { public void setComments(List<CommentVo> comments) {
this.comments = comments; this.comments = comments;
} }
...@@ -213,11 +215,11 @@ public class Msg { ...@@ -213,11 +215,11 @@ public class Msg {
this.gifts = gifts; this.gifts = gifts;
} }
public List<Praise> getPraises() { public List<PraiseVo> getPraises() {
return praises; return praises;
} }
public void setPraises(List<Praise> praises) { public void setPraises(List<PraiseVo> praises) {
this.praises = praises; this.praises = praises;
} }
......
package com.xxfc.platform.im.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import java.io.*;
import java.net.*;
/**
* 根据IP地址获取详细的地域信息 淘宝API :
* http://ip.taobao.com/service/getIpInfo.php?ip=218.192.3.42 新浪API :
* http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=218.192.3.42
*
* @File AddressUtils.java
* @Package org.gditc.weicommunity.util
* @Description TODO
* @Copyright Copyright © 2014
* @Site https://github.com/Cryhelyxx
* @Blog http://blog.csdn.net/Cryhelyxx
* @Email cryhelyxx@gmail.com
* @Company GDITC
* @Date 2014年11月6日 下午1:46:37
* @author Cryhelyxx
* @version 1.0
*/
@Slf4j
public class AddressUtils {
/**
*
* @param content
* 请求的参数 格式为:name=xxx&pwd=xxx
* @param encoding
* 服务器端请求编码。如GBK,UTF-8等
* @return
* @throws UnsupportedEncodingException
*/
private static final String APPKEY = "1DXbTfk6mChS5yvO9GxVnIDZzH5p9FKE";
public static String getAddresses(String ip) throws UnsupportedEncodingException {
// 这里调用淘宝API
String urlStr = "http://ip.taobao.com/service/getIpInfo.php";
// 从http://whois.pconline.com.cn取得IP所在的省市区信息
if (!ip.contains(":")) {
String returnStr = getResult(urlStr, "ip=" + ip, "utf-8");
if (!StringUtils.isEmpty(returnStr)) {
// 处理返回的省市区信息
System.out.println(returnStr);
JSONObject jsonObject = JSONObject.parseObject(returnStr);
returnStr = JSONObject.parseObject(jsonObject.getString("data")).getString("country") + " "
+ JSONObject.parseObject(jsonObject.getString("data")).getString("region") + " "
+ JSONObject.parseObject(jsonObject.getString("data")).getString("city") + " "
+ JSONObject.parseObject(jsonObject.getString("data")).getString("isp");
return returnStr;
}
}
return null;
}
/**
* @param urlStr
* 请求的地址
* @param content
* 请求的参数 格式为:name=xxx&pwd=xxx
* @param encoding
* 服务器端请求编码。如GBK,UTF-8等
* @return
*/
private static String getResult(String urlStr, String content, String encoding) {
URL url = null;
HttpURLConnection connection = null;
try {
url = new URL(urlStr);
connection = (HttpURLConnection) url.openConnection();// 新建连接实例
connection.setConnectTimeout(2000);// 设置连接超时时间,单位毫秒
connection.setReadTimeout(2000);// 设置读取数据超时时间,单位毫秒
connection.setDoOutput(true);// 是否打开输出流 true|false
connection.setDoInput(true);// 是否打开输入流true|false
connection.setRequestMethod("POST");// 提交方法POST|GET
connection.setUseCaches(false);// 是否缓存true|false
connection.connect();// 打开连接端口
DataOutputStream out = new DataOutputStream(connection.getOutputStream());// 打开输出流往对端服务器写数据
out.writeBytes(content);// 写数据,也就是提交你的表单 name=xxx&pwd=xxx
out.flush();// 刷新
out.close();// 关闭输出流
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), encoding));// 往对端写完数据对端服务器返回数据
// ,以BufferedReader流来读取
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null) {
buffer.append(line);
}
reader.close();
return buffer.toString();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (connection != null) {
connection.disconnect();// 关闭连接
}
}
return null;
}
/**
* unicode 转换成 中文
*
* @author fanhui 2007-3-15
* @param theString
* @return
*/
public static String decodeUnicode(String theString) {
char aChar;
int len = theString.length();
StringBuffer outBuffer = new StringBuffer(len);
for (int x = 0; x < len;) {
aChar = theString.charAt(x++);
if (aChar == '\\') {
aChar = theString.charAt(x++);
if (aChar == 'u') {
int value = 0;
for (int i = 0; i < 4; i++) {
aChar = theString.charAt(x++);
switch (aChar) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
value = (value << 4) + aChar - '0';
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
value = (value << 4) + 10 + aChar - 'a';
break;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
value = (value << 4) + 10 + aChar - 'A';
break;
default:
throw new IllegalArgumentException("Malformed encoding.");
}
}
outBuffer.append((char) value);
} else {
if (aChar == 't') {
aChar = '\t';
} else if (aChar == 'r') {
aChar = '\r';
} else if (aChar == 'n') {
aChar = '\n';
} else if (aChar == 'f') {
aChar = '\f';
}
outBuffer.append(aChar);
}
} else {
outBuffer.append(aChar);
}
}
return outBuffer.toString();
}
/**
* @param addr
* 查询的地址
* @return
* @throws IOException
*/
public Object[] getCoordinate(String addr) throws IOException {
String lng = null;//经度
String lat = null;//纬度
String address = null;
try {
address = URLEncoder.encode(addr, "UTF-8");
}catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
String url = String .format("http://api.map.baidu.com/geocoder?address=%s&output=json&key=%s", address, APPKEY);
URL myURL = null;
URLConnection httpsConn = null;
try {
myURL = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
InputStreamReader insr = null;
BufferedReader br = null;
try {
httpsConn = (URLConnection) myURL.openConnection();// 不使用代理
if (httpsConn != null) {
insr = new InputStreamReader( httpsConn.getInputStream(), "UTF-8");
br = new BufferedReader(insr);
String data = null;
int count = 1;
while((data= br.readLine())!=null){
if(count==5){
lng = (String)data.subSequence(data.indexOf(":")+1, data.indexOf(","));//经度
count++;
}else if(count==6){
lat = data.substring(data.indexOf(":")+1);//纬度
count++;
}else{
count++;
}
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if(insr!=null){
insr.close();
}
if(br!=null){
br.close();
}
}
return new Object[]{lng,lat};
}
public static String getLocationByBaiduMap(String longitude,String latitude) throws Exception {
String addrJson = geturl("http://api.map.baidu.com/geocoder/v2/?ak=" + APPKEY + "&location=" + latitude + "," + longitude + "&output=json&pois=1");
System.out.println(addrJson);
JSONObject jobjectaddr = JSON.parseObject(addrJson);
//JSONObject rJsonObject=jobjectaddr.getJSONObject("result");
//System.out.println(rJsonObject);
String addr=jobjectaddr.getJSONObject("result").getString("formatted_address");
//addr=(String) JSON.parseObject(addr).get("city");
//addr=new String(addr.getBytes("gbk"),"UTF-8");
return addr;
}
private static String geturl(String geturl) throws Exception {
//请求的webservice的url
URL url = new URL(geturl);
//创建http链接
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
//设置请求的方法类型
httpURLConnection.setRequestMethod("POST");
//设置请求的内容类型
httpURLConnection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
//设置发送数据
httpURLConnection.setDoOutput(true);
//设置接受数据
httpURLConnection.setDoInput(true);
//发送数据,使用输出流
OutputStream outputStream = httpURLConnection.getOutputStream();
//发送的soap协议的数据
// String requestXmlString = requestXml("北京");
String content = "user_id="+ URLEncoder.encode("13846", "utf-8");
//发送数据
outputStream.write(content.getBytes());
//接收数据
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = in.readLine()) != null){
buffer.append(line);
}
String str = buffer.toString();
return str;
}
public static String getMapaddress(String lats,String lngs){
try{
// AK 百度开放平台申请的KEY
URL url = new URL("http://api.map.baidu.com/geocoder/v2/?ak=wPPxsfCtNFm4PqEV68jbDdjP7U4twstj&callback=renderReverse&location="+ lats + "," + lngs + "&output=json&pois=1");
HttpURLConnection ucon = (HttpURLConnection) url.openConnection();
ucon.connect();
InputStream in = ucon.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in,"UTF-8"));
String str = reader.readLine();
str = str.substring(str.indexOf("(") + 1, str.length()-1);
log.info("解析的地址,str = {}", str);
JSONObject jsonObject = JSONObject.parseObject(str);
String address = "";
address = jsonObject.getJSONObject("result").getString("formatted_address");
in.close();
reader.close();
return address;
/*outprint.print(address);
outprint.close();
outprint=null; */
}catch(Exception e){
e.printStackTrace();
}
return "";
}
// 测试
public static void main(String[] args) {
// 测试ip 219.136.134.157 中国=华南=广东省=广州市=越秀区=电信
String ip = "219.136.134.157";
String address = "";
try {
address = getMapaddress("37.2365037325","97.9164620226");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(address);
// 输出结果为:广东省,广州市,越秀区
}
}
\ No newline at end of file
package com.xxfc.platform.im.utils; package com.xxfc.platform.im.utils;
import com.mongodb.DBObject; import com.mongodb.DBObject;
import org.apache.commons.beanutils.BeanUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
......
package com.xxfc.platform.im.vo;
import com.xxfc.platform.im.model.Msg;
import lombok.Data;
@Data
public class MsgVo extends Msg {
private String picUrl;
private String address;
private String msgId;
}
package com.xxfc.platform.im.vo; package com.xxfc.platform.im.vo;
import com.xxfc.platform.im.entity.ImComment;
import com.xxfc.platform.im.entity.ImPraise; import com.xxfc.platform.im.entity.ImPraise;
import com.xxfc.platform.im.entity.ImQuestion; import com.xxfc.platform.im.entity.ImQuestion;
import com.xxfc.platform.im.entity.ImComment;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform-web/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
<targetJavaProject>${basedir}/src/main/java</targetJavaProject> <targetJavaProject>${basedir}/src/main/java</targetJavaProject>
<targetMapperPackage>com.xxfc.platform.im.mapper <targetMapperPackage>com.xxfc.platform.im.mapper
</targetMapperPackage> </targetMapperPackage>
<targetModelPackage>com.xxfc.platform.im.entity <targetModelPackage>com.xxfc.platform.im.feign.entity
</targetModelPackage> </targetModelPackage>
<!-- XML生成路径 --> <!-- XML生成路径 -->
<targetResourcesProject>${basedir}/src/main/resources <targetResourcesProject>${basedir}/src/main/resources
...@@ -33,47 +34,12 @@ ...@@ -33,47 +34,12 @@
</properties> </properties>
<dependencies> <dependencies>
<!--引入开源后台项目的公共包-->
<dependency>
<groupId>com.github.wxiaoqi</groupId>
<artifactId>ace-auth-client</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<!-- 自己项目 -->
<dependency> <dependency>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
<artifactId>xx-im-api</artifactId> <artifactId>xx-im-api</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
</dependency> </dependency>
<!--mongodb-->
<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>7.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.1.14</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
...@@ -33,15 +33,16 @@ public class ImCommentBiz extends BaseBiz<ImCommentMapper, ImComment> { ...@@ -33,15 +33,16 @@ public class ImCommentBiz extends BaseBiz<ImCommentMapper, ImComment> {
return ObjectRestResponse.createFailedResult(508, "token is null or invalid"); return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
} }
imComment.setUserId(Long.parseLong(appUserDTO.getImUserid() + "")); imComment.setUserId(Long.parseLong(appUserDTO.getImUserid() + ""));
imComment.setNickname(appUserDTO.getNickname());
imComment.setPicUrl(appUserDTO.getHeadimgurl());
if (imComment == null || imComment.getQuestionId() == null) { if (imComment == null || imComment.getQuestionId() == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
ImQuestion imQuestion = imQuestionBiz.selectById(imComment.getQuestionId()); ImQuestion imQuestion = imQuestionBiz.selectById(imComment.getQuestionId());
if (imQuestion == null) { if (imQuestion == null) {
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
mapper.insert(imComment); insertSelective(imComment);
//修改评论数 //修改评论数
imQuestionBiz.update(imComment.getQuestionId(), MsgTypeEnum.comment, UpdateTypeEnum.add); imQuestionBiz.update(imComment.getQuestionId(), MsgTypeEnum.comment, UpdateTypeEnum.add);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
...@@ -66,7 +67,7 @@ public class ImCommentBiz extends BaseBiz<ImCommentMapper, ImComment> { ...@@ -66,7 +67,7 @@ public class ImCommentBiz extends BaseBiz<ImCommentMapper, ImComment> {
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
oldValue.setIsDel(true); oldValue.setIsDel(true);
mapper.updateByPrimaryKeySelective(oldValue); updateSelectiveByIdRe(oldValue);
imQuestionBiz.update(oldValue.getQuestionId(), MsgTypeEnum.comment, UpdateTypeEnum.subtraction); imQuestionBiz.update(oldValue.getQuestionId(), MsgTypeEnum.comment, UpdateTypeEnum.subtraction);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
...@@ -36,6 +36,8 @@ public class ImPraiseBiz extends BaseBiz<ImPraiseMapper, ImPraise> { ...@@ -36,6 +36,8 @@ public class ImPraiseBiz extends BaseBiz<ImPraiseMapper, ImPraise> {
return ObjectRestResponse.createFailedResult(508, "token is null or invalid"); return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
} }
imPraiseDto.setUserId(Long.parseLong(appUserDTO.getImUserid() + "")); imPraiseDto.setUserId(Long.parseLong(appUserDTO.getImUserid() + ""));
imPraiseDto.setNickname(appUserDTO.getNickname());
imPraiseDto.setPicUrl(appUserDTO.getHeadimgurl());
if(imPraiseDto == null || imPraiseDto.getQuestionId() == null) { if(imPraiseDto == null || imPraiseDto.getQuestionId() == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
...@@ -47,7 +49,7 @@ public class ImPraiseBiz extends BaseBiz<ImPraiseMapper, ImPraise> { ...@@ -47,7 +49,7 @@ public class ImPraiseBiz extends BaseBiz<ImPraiseMapper, ImPraise> {
if(list.size() >= 1) { if(list.size() >= 1) {
return ObjectRestResponse.createFailedResult(504,"今日已点赞,请明日再点!"); return ObjectRestResponse.createFailedResult(504,"今日已点赞,请明日再点!");
} }
mapper.insert(imPraiseDto); insertSelective(imPraiseDto);
imQuestionBiz.update(imPraiseDto.getQuestionId(), MsgTypeEnum.praise, UpdateTypeEnum.add); imQuestionBiz.update(imPraiseDto.getQuestionId(), MsgTypeEnum.praise, UpdateTypeEnum.add);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -68,7 +70,7 @@ public class ImPraiseBiz extends BaseBiz<ImPraiseMapper, ImPraise> { ...@@ -68,7 +70,7 @@ public class ImPraiseBiz extends BaseBiz<ImPraiseMapper, ImPraise> {
List<ImPraise> list = getImPraiseList(imPraiseDto); List<ImPraise> list = getImPraiseList(imPraiseDto);
if(list.size() == 1) { if(list.size() == 1) {
list.get(0).setIsDel(true); list.get(0).setIsDel(true);
mapper.updateByPrimaryKey(list.get(0)); updateSelectiveByIdRe(list.get(0));
imQuestionBiz.update(list.get(0).getQuestionId(), MsgTypeEnum.praise, UpdateTypeEnum.subtraction); imQuestionBiz.update(list.get(0).getQuestionId(), MsgTypeEnum.praise, UpdateTypeEnum.subtraction);
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
......
...@@ -38,6 +38,13 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -38,6 +38,13 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
return new ObjectRestResponse<>().data(pageDataVO); return new ObjectRestResponse<>().data(pageDataVO);
} }
public ObjectRestResponse one(Integer id) {
return ObjectRestResponse.succ(mapper.getOne(id));
}
/** /**
* 添加问题 * 添加问题
* *
...@@ -50,10 +57,12 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -50,10 +57,12 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
return ObjectRestResponse.createFailedResult(508, "token is null or invalid"); return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
} }
imQuestion.setUserId(Long.parseLong(appUserDTO.getImUserid() + "")); imQuestion.setUserId(Long.parseLong(appUserDTO.getImUserid() + ""));
imQuestion.setNickname(appUserDTO.getNickname());
imQuestion.setPicUrl(appUserDTO.getHeadimgurl());
if (imQuestion == null) { if (imQuestion == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
mapper.insertSelective(imQuestion); insertSelective(imQuestion);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -76,7 +85,7 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -76,7 +85,7 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
imQuestion.setIsDel(true); imQuestion.setIsDel(true);
mapper.updateByPrimaryKeySelective(imQuestion); updateSelectiveByIdRe(imQuestion);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -108,7 +117,7 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -108,7 +117,7 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
} }
} }
} }
mapper.updateByPrimaryKeySelective(imQuestion); updateSelectiveByIdRe(imQuestion);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
package com.xxfc.platform.im.biz; package com.xxfc.platform.im.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.im.dto.CommentVo;
import com.xxfc.platform.im.dto.PraiseVo;
import com.xxfc.platform.im.model.Comment; import com.xxfc.platform.im.model.Comment;
import com.xxfc.platform.im.model.Msg; import com.xxfc.platform.im.model.Msg;
import com.xxfc.platform.im.model.Praise; import com.xxfc.platform.im.model.Praise;
import com.xxfc.platform.im.utils.AddressUtils;
import com.xxfc.platform.im.vo.MsgVo;
import lombok.extern.slf4j.Slf4j;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
@Component @Service
@Slf4j
public class MsgBiz { public class MsgBiz {
@Autowired @Autowired
...@@ -31,42 +38,70 @@ public class MsgBiz { ...@@ -31,42 +38,70 @@ public class MsgBiz {
/** /**
* 获取消息列表 * 获取消息列表
* *
* @param map
* @return * @return
* @throws Exception * @throws Exception
*/ */
public ObjectRestResponse getMsgList(Map<String, Object> map) throws Exception { public ObjectRestResponse getMsgList(Integer page, Integer limit, Integer type) throws Exception {
//获取所有朋友圈 //获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
if (appUserDTO == null) { if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(508, "token is null or invalid"); return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
} }
Integer page = map.get("page") == null ? 1 : Integer.parseInt(map.get("page").toString()); log.info("获取消息列表: page = {}, limit = {}, type = {}", page, limit, type);
Integer limit = map.get("limit") == null ? 10 : Integer.parseInt(map.get("limit").toString()); page = page == null ? 1 : page;
limit = limit == null ? 10 : limit;
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
Query query = null; Query query = null;
List<Msg> msgList = null; List<Msg> msgList = null;
if (map.get("type") != null) { if (type != null) {
query = new Query(Criteria.where("body.type").is(Integer.parseInt(map.get("type").toString()))); query = new Query(Criteria.where("body.type").is(type));
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid()); msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid());
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo);
} else { } else {
msgList = fetchAndAttach(mongoTemplate.findAll(Msg.class, "s_msg"), appUserDTO.getImUserid()); List<Integer> ids = new ArrayList<>();
ids.add(2);
ids.add(4);
query = new Query(Criteria.where("body.type").in(ids));
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid());
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo);
} }
PageInfo<Msg> goodPageInfo = new PageInfo<>(msgList);
return ObjectRestResponse.succ(goodPageInfo);
} }
public ObjectRestResponse getHotMsgList(Map<String, Object> param) { public ObjectRestResponse getHotMsgList(Integer page, Integer limit) {
Integer page = param.get("page") == null ? 1 : Integer.parseInt(param.get("page").toString()); log.info("获取消息列表: page = {}, limit = {}, type = {}", page, limit);
Integer limit = param.get("limit") == null ? 10 : Integer.parseInt(param.get("limit").toString()); page = page == null ? 1 : page;
limit = limit == null ? 10 : limit;
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
Query query = new Query(); List<Integer> ids = new ArrayList<>();
ids.add(2);
ids.add(4);
Query query = new Query(Criteria.where("body.type").in(ids));
query.with(new Sort(Sort.Direction.DESC, "count.praise")); query.with(new Sort(Sort.Direction.DESC, "count.praise"));
List<Msg> msgList = mongoTemplate.find(query, Msg.class, "s_msg"); List<Msg> msgList = mongoTemplate.find(query, Msg.class, "s_msg");
PageInfo<Msg> goodPageInfo = new PageInfo<>(msgList); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} }
public ObjectRestResponse get(String id){
//获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
}
if(id == null) {
return ObjectRestResponse.paramIsEmpty();
}
Query query = new Query(Criteria.where("id").is(new ObjectId(id)));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid());
List<MsgVo> msgVoList = replaceMsgResult(msgList);
if(msgVoList.size() > 0) {
return ObjectRestResponse.succ(msgVoList.get(0));
}
return ObjectRestResponse.succ();
}
/** /**
* 添加评论和点赞 * 添加评论和点赞
...@@ -81,16 +116,16 @@ public class MsgBiz { ...@@ -81,16 +116,16 @@ public class MsgBiz {
} }
for (Msg msg : list) { for (Msg msg : list) {
//添加评论 //添加评论
Query query = new Query(Criteria.where("msgId").is(msg.getMsgId())); Query query = new Query(Criteria.where("msgId").is(msg.getId()));
List<Comment> comments = mongoTemplate.find(query, Comment.class, "s_comment"); List<Comment> comments = mongoTemplate.find(query, Comment.class, "s_comment");
msg.setComments(comments); msg.setComments(replaceCommentResult(comments));
//添加点赞 //添加点赞
List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise"); List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise");
msg.setPraises(praise); msg.setPraises(replacePraiseResult(praise));
msg.setIsPraise(this.exists(userId, msg.getMsgId()) ? 1 : 0); msg.setIsPraise(this.exists(userId, msg.getId()) ? 1 : 0);
msg.setIsCollect(this.existsCollect(userId, msg.getMsgId()) ? 1 : 0); msg.setIsCollect(this.existsCollect(userId, msg.getId()) ? 1 : 0);
} }
return list; return list;
} }
...@@ -120,4 +155,47 @@ public class MsgBiz { ...@@ -120,4 +155,47 @@ public class MsgBiz {
List<Comment> comments = mongoTemplate.find(query, Comment.class, "s_comment"); List<Comment> comments = mongoTemplate.find(query, Comment.class, "s_comment");
return 0 != comments.size(); return 0 != comments.size();
} }
public List<MsgVo> replaceMsgResult(List<Msg> list) {
List<MsgVo> msgVoList = new ArrayList<>();
for(Msg msg : list) {
MsgVo msgVo = new MsgVo();
BeanUtil.copyProperties(msg, msgVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
//添加用户昵称和头像
msgVo.setNickname("李晓雨");
msgVo.setPicUrl("https://xxfcim.upyuns.com/image/u/2/10000002/201905/o/75ca94441f084d44822bb21c6247a7a1.png");
String address = AddressUtils.getMapaddress(msg.getLatitude().toString(), msg.getLongitude().toString());
msgVo.setAddress(address);
msgVo.setMsgId(msg.getId().toString());
msgVoList.add(msgVo);
}
return msgVoList;
}
public List<PraiseVo> replacePraiseResult(List<Praise> list) {
List<PraiseVo> praiseVoArrayList = new ArrayList<>();
for(Praise praise : list) {
PraiseVo praiseVo = new PraiseVo();
BeanUtil.copyProperties(praise, praiseVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
//添加用户昵称和头像
praiseVo.setNickname("李晓雨");
praiseVo.setPicUrl("https://xxfcim.upyuns.com/image/u/2/10000002/201905/o/75ca94441f084d44822bb21c6247a7a1.png");
praiseVoArrayList.add(praiseVo);
}
return praiseVoArrayList;
}
public List<CommentVo> replaceCommentResult(List<Comment> list) {
List<CommentVo> commentVoList = new ArrayList<>();
for(Comment comment : list) {
CommentVo commentVo = new CommentVo();
BeanUtil.copyProperties(comment, commentVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
//添加用户昵称和头像
commentVo.setNickname("李晓雨");
commentVo.setPicUrl("https://xxfcim.upyuns.com/image/u/2/10000002/201905/o/75ca94441f084d44822bb21c6247a7a1.png");
commentVoList.add(commentVo);
}
return commentVoList;
}
} }
...@@ -10,5 +10,5 @@ import java.util.Map; ...@@ -10,5 +10,5 @@ import java.util.Map;
public interface ImQuestionMapper extends Mapper<ImQuestion> { public interface ImQuestionMapper extends Mapper<ImQuestion> {
List<QuestionListVo> getQuestionList(Map<String, Object> param); List<QuestionListVo> getQuestionList(Map<String, Object> param);
QuestionListVo getOne(Integer id);
} }
\ No newline at end of file
...@@ -6,10 +6,7 @@ import com.xxfc.platform.im.entity.ImComment; ...@@ -6,10 +6,7 @@ import com.xxfc.platform.im.entity.ImComment;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping(value = "imComment") @RequestMapping(value = "imComment")
...@@ -21,7 +18,7 @@ public class ImCommentController { ...@@ -21,7 +18,7 @@ public class ImCommentController {
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ApiOperation(value = "添加评论") @ApiOperation(value = "添加评论")
public ObjectRestResponse add(ImComment imComment) { public ObjectRestResponse add(@RequestBody ImComment imComment) {
return imCommentBiz.add(imComment); return imCommentBiz.add(imComment);
} }
......
...@@ -6,10 +6,7 @@ import com.xxfc.platform.im.dto.ImPraiseDto; ...@@ -6,10 +6,7 @@ import com.xxfc.platform.im.dto.ImPraiseDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping(value = "imPraise") @RequestMapping(value = "imPraise")
...@@ -21,7 +18,7 @@ public class ImPraiseController { ...@@ -21,7 +18,7 @@ public class ImPraiseController {
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ApiOperation(value = "添加点赞") @ApiOperation(value = "添加点赞")
public ObjectRestResponse add(ImPraiseDto imPraise) { public ObjectRestResponse add(@RequestBody ImPraiseDto imPraise) {
return imPraiseBiz.add(imPraise); return imPraiseBiz.add(imPraise);
} }
......
...@@ -8,10 +8,7 @@ import com.xxfc.platform.im.vo.QuestionListVo; ...@@ -8,10 +8,7 @@ import com.xxfc.platform.im.vo.QuestionListVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
...@@ -28,10 +25,14 @@ public class ImQuestionController { ...@@ -28,10 +25,14 @@ public class ImQuestionController {
public ObjectRestResponse<List<QuestionListVo>> getList(QuestionParamDto questionParamDto) { public ObjectRestResponse<List<QuestionListVo>> getList(QuestionParamDto questionParamDto) {
return imQuestionBiz.getList(questionParamDto); return imQuestionBiz.getList(questionParamDto);
} }
@GetMapping(value = "/one")
@ApiOperation(value = "获取问答列表信息")
public ObjectRestResponse<ImQuestion> one(Integer id) {
return imQuestionBiz.one(id);
}
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ApiOperation(value = "添加问答信息") @ApiOperation(value = "添加问答信息")
public ObjectRestResponse add(ImQuestion imQuestion) { public ObjectRestResponse add(@RequestBody ImQuestion imQuestion) {
return imQuestionBiz.add(imQuestion); return imQuestionBiz.add(imQuestion);
} }
......
package com.xxfc.platform.im.rest; package com.xxfc.platform.im.rest;
import com.alibaba.fastjson.JSONArray;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.mongodb.DBCursor;
import com.xxfc.platform.im.biz.MsgBiz; import com.xxfc.platform.im.biz.MsgBiz;
import com.xxfc.platform.im.biz.UserBiz;
import com.xxfc.platform.im.model.Msg;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.Map; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("msg") @RequestMapping("msg")
...@@ -19,12 +16,19 @@ public class MsgController { ...@@ -19,12 +16,19 @@ public class MsgController {
private MsgBiz msgBiz; private MsgBiz msgBiz;
@PostMapping(value = "/app/unauth/list") @PostMapping(value = "/app/unauth/list")
public ObjectRestResponse getMsgList(@RequestBody Map<String,Object> map)throws Exception{ public ObjectRestResponse getMsgList(Integer page, Integer limit, Integer type)throws Exception{
return msgBiz.getMsgList(map); return msgBiz.getMsgList(page, limit, type);
} }
@PostMapping(value = "/hotMsg/list") @PostMapping(value = "/hotMsg/list")
public ObjectRestResponse getHotMsgList(Map<String, Object> map) { public ObjectRestResponse getHotMsgList(Integer page, Integer limit) {
return msgBiz.getHotMsgList(map); return msgBiz.getHotMsgList(page, limit);
} }
@GetMapping(value = "/get")
public ObjectRestResponse get(String id) {
return msgBiz.get(id);
}
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
</resultMap> </resultMap>
<resultMap id="listResultMap" type="com.xxfc.platform.im.vo.QuestionListVo"> <resultMap id="listResultMap" type="com.xxfc.platform.im.vo.QuestionListVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<collection property="imComment" column="id" <collection property="imComment" column="id"
select="com.xxfc.platform.im.mapper.ImCommentMapper.selectByQuestionId" select="com.xxfc.platform.im.mapper.ImCommentMapper.selectByQuestionId"
ofType="com.xxfc.platform.im.entity.ImComment"> ofType="com.xxfc.platform.im.entity.ImComment">
...@@ -42,7 +43,12 @@ ...@@ -42,7 +43,12 @@
and is_del = #{isDel} and is_del = #{isDel}
</if> </if>
</where> </where>
order by praise_count, comment_count DESC order by upd_time DESC
</select>
<select id="getOne" parameterType="java.lang.Integer" resultMap="listResultMap">
select * from im_question
where id = #{id}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,7 +7,7 @@ import java.math.BigDecimal; ...@@ -7,7 +7,7 @@ import java.math.BigDecimal;
@Table(name = "order_vehicle_crosstown") @Table(name = "order_vehicle_crosstown")
@Data @Data
public class OrderVehicaleCrosstown { public class OrderVehicleCrosstown {
/** /**
* 主键id * 主键id
*/ */
......
package com.xxfc.platform.order.pojo.order; package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown; import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import lombok.Data; import lombok.Data;
@Data @Data
public class OrderVehicleCrosstownDto extends OrderVehicaleCrosstown { public class OrderVehicleCrosstownDto extends OrderVehicleCrosstown {
String userLicenses; String userLicenses;
/** /**
* 驾驶人 * 驾驶人
...@@ -25,4 +25,6 @@ public class OrderVehicleCrosstownDto extends OrderVehicaleCrosstown { ...@@ -25,4 +25,6 @@ public class OrderVehicleCrosstownDto extends OrderVehicaleCrosstown {
* 驾驶人身份证号 * 驾驶人身份证号
*/ */
private String licenseIdCard; private String licenseIdCard;
private String vehicleNumberPlat;
} }
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
...@@ -25,6 +24,7 @@ import com.xxfc.platform.universal.dto.SmsTemplateDTO; ...@@ -25,6 +24,7 @@ import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.OrderRefundVo; import com.xxfc.platform.universal.vo.OrderRefundVo;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense; import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -125,6 +125,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -125,6 +125,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
if(orderPageVo.getStatus() == 4) { //未交车 if(orderPageVo.getStatus() == 4) { //未交车
List<VehicleUserLicense> vehicleUserLicenses = Lists.newArrayList(); List<VehicleUserLicense> vehicleUserLicenses = Lists.newArrayList();
boolean flag = getTodyTime(orderPageVo.getOrderRentVehicleDetail().getStartTime());
if(!flag) {
return ObjectRestResponse.createFailedResult(3501, "今日不是交车日期");
}
String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds(); String myDriverIds = orderPageVo.getOrderRentVehicleDetail().getMyDriverIds();
if(StringUtils.isNotBlank(myDriverIds)) { if(StringUtils.isNotBlank(myDriverIds)) {
if(myDriverIds.contains(",")) { if(myDriverIds.contains(",")) {
...@@ -152,9 +157,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -152,9 +157,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto(); OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto();
orderVehicleCrosstownDto.setOrderId(orderPageVo.getId()); orderVehicleCrosstownDto.setOrderId(orderPageVo.getId());
orderVehicleCrosstownDto.setOrderNo(orderPageVo.getNo()); orderVehicleCrosstownDto.setOrderNo(orderPageVo.getNo());
List<OrderVehicaleCrosstown> orderVehicaleCrosstowns = orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto); List<OrderVehicleCrosstown> orderVehicleCrosstowns = orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
if(orderVehicaleCrosstowns != null && orderVehicaleCrosstowns.size() > 0) { if(orderVehicleCrosstowns != null && orderVehicleCrosstowns.size() > 0) {
List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(orderVehicaleCrosstowns.get(0).getUserLicenseId()).getData(); List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(orderVehicleCrosstowns.get(0).getUserLicenseId()).getData();
if(orderUserLicenses != null && orderUserLicenses.size() > 0) { if(orderUserLicenses != null && orderUserLicenses.size() > 0) {
orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getLicenseIdCard()); orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getLicenseIdCard());
orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getLicenseImg()); orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getLicenseImg());
...@@ -165,7 +170,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -165,7 +170,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
} }
orderPageVo.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto); orderPageVo.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto);
} }
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderPageVo.getOrderRentVehicleDetail().getVehicleId());
if(restResponse.getData() != null) {
orderPageVo.setVehicalNumberPlat(restResponse.getData().getNumberPlate());
}
return ObjectRestResponse.succ(orderPageVo); return ObjectRestResponse.succ(orderPageVo);
} }
...@@ -504,4 +512,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -504,4 +512,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
throw new BaseException(ResultCode.DB_OPERATION_FAIL_CODE); throw new BaseException(ResultCode.DB_OPERATION_FAIL_CODE);
} }
} }
public boolean getTodyTime(Long time) {
Long startTime = getDayStart();
if(time > startTime && time < startTime + 24 * 60 * 60 * 1000 - 1) {
return true;
}
return false;
}
public static Long getDayStart() {
long current = System.currentTimeMillis();
long zero = current/(1000*3600*24)*(1000*3600*24) - TimeZone.getDefault().getRawOffset();
return zero;
}
} }
\ No newline at end of file
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import com.ace.cache.annotation.Cache; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderUserLicense;
import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper; import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto; import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@Service @Service
public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapper, OrderVehicaleCrosstown> { @Slf4j
public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapper, OrderVehicleCrosstown> {
public OrderVehicaleCrosstown get(Integer id){ @Autowired
OrderVehicalCrosstownBiz orderVehicalCrosstownBiz;
@Autowired
OrderUserLicenseBiz orderUserLicenseBiz;
@Autowired
VehicleFeign vehicleFeign;
@Autowired
private OrderRentVehicleBiz orderRentVehicleBiz;
@Autowired
BaseOrderBiz baseOrderBiz;
public OrderVehicleCrosstown get(Integer id){
return selectById(id); return selectById(id);
} }
public List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) { public List<OrderVehicleCrosstown> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
return mapper.selectByOrderId(orderVehicleCrosstownDto); return mapper.selectByOrderId(orderVehicleCrosstownDto);
} }
public ObjectRestResponse<OrderVehicleCrosstownDto> add(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicleCrosstownDto);
if (orderVehicleCrosstownDto == null || orderVehicleCrosstownDto.getOrderId() == null ) {
return ObjectRestResponse.createFailedResult(500, "参数为空!");
}
BaseOrder baseOrder = baseOrderBiz.selectById(orderVehicleCrosstownDto.getOrderId());
if(baseOrder == null) {
return ObjectRestResponse.createFailedResult(500,"订单不存在!");
}
OrderRentVehicleDetail orderRentVehicleDetail = orderRentVehicleBiz.selectById(baseOrder.getDetailId());
List<OrderVehicleCrosstown> oldValue = orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
if (oldValue .size() == 1) {
//已有直接返回
//交车完成 设置订单状态为出行中
if(baseOrder.getStatus() == 4) {//
//判断交车时间是否是今天
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
}
OrderVehicleCrosstownDto vehicleCrosstownDto = new OrderVehicleCrosstownDto();
BeanUtil.copyProperties(oldValue.get(0), vehicleCrosstownDto, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(oldValue.get(0).getUserLicenseId()).getData();
if(orderUserLicenses != null && orderUserLicenses.size() > 0) {
orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getLicenseIdCard());
orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getLicenseImg());
orderVehicleCrosstownDto.setLicenseName(orderUserLicenses.get(0).getLicenseName());
orderVehicleCrosstownDto.setLicensePhone(orderUserLicenses.get(0).getLicensePhone());
}
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId());
if(restResponse.getData() != null) {
vehicleCrosstownDto.setVehicleNumberPlat(restResponse.getData().getNumberPlate());
}
return ObjectRestResponse.succ(vehicleCrosstownDto);
} else if(oldValue .size() <= 0) {
getOrderLicense(orderVehicleCrosstownDto);
orderVehicalCrosstownBiz.insertSelective(orderVehicleCrosstownDto);
//交车完成 设置订单状态为出行中
if(baseOrder.getStatus() == 4) {
//判断是否是今日交车
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
}
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId());
if(restResponse.getData() != null) {
orderVehicleCrosstownDto.setVehicleNumberPlat(restResponse.getData().getNumberPlate());
}
return ObjectRestResponse.succ(orderVehicleCrosstownDto);
}
return ObjectRestResponse.createDefaultFail();
}
public void getOrderLicense(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
OrderUserLicense orderUserLicense = new OrderUserLicense();
orderUserLicense.setLicenseIdCard(orderVehicleCrosstownDto.getLicenseIdCard());
orderUserLicense.setLicenseImg(orderVehicleCrosstownDto.getLicenseImg());
orderUserLicense.setLicenseName(orderVehicleCrosstownDto.getLicenseName());
orderUserLicense.setLicensePhone(orderVehicleCrosstownDto.getLicensePhone());
if(orderUserLicense != null) {
Integer id = orderUserLicenseBiz.add(orderUserLicense).getData().getId();
orderVehicleCrosstownDto.setUserLicenseId(id + "");
}
}
} }
...@@ -8,7 +8,7 @@ import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz; ...@@ -8,7 +8,7 @@ import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz;
import com.xxfc.platform.order.contant.enumerate.*; import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.BaseOrder; import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail; import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown; import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.pojo.DedDetailDTO; import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.universal.constant.DictionaryKey; import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
...@@ -72,7 +72,7 @@ public class RentDepositHandler extends IJobHandler { ...@@ -72,7 +72,7 @@ public class RentDepositHandler extends IJobHandler {
}}); }});
//未退还, 进行保留违章预备金 的退还 //未退还, 进行保留违章预备金 的退还
if(RefundStatusEnum.NONE.getCode().equals(baseOrder.getRefundStatus())) { if(RefundStatusEnum.NONE.getCode().equals(baseOrder.getRefundStatus())) {
OrderVehicaleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicaleCrosstown(){{ OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
setType(CrosstownTypeEnum.TOUR.getCode()); setType(CrosstownTypeEnum.TOUR.getCode());
}}); }});
......
package com.xxfc.platform.order.mapper; package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown; import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto; import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
public interface OrderVehicaleCrosstownMapper extends Mapper<OrderVehicaleCrosstown> { public interface OrderVehicaleCrosstownMapper extends Mapper<OrderVehicleCrosstown> {
List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto); List<OrderVehicleCrosstown> selectByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto);
} }
\ No newline at end of file
...@@ -217,7 +217,17 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -217,7 +217,17 @@ public class BaseOrderController extends CommonBaseController implements UserRes
} }
} }
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.getRentVehicle(query.getSuper())); PageDataVO<OrderPageVO> pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.getRentVehicle(query.getSuper()));
for(OrderPageVO orderPageVO : pageDataVO.getData()) {
if (orderPageVO.getOrderRentVehicleDetail() != null && orderPageVO.getOrderRentVehicleDetail().getVehicleId() != null) {
ObjectRestResponse<Vehicle> restResponse = vehicleFeign.get(orderPageVO.getOrderRentVehicleDetail().getVehicleId());
log.info("获取车辆信息返回消息:{}", restResponse.getMessage());
if (restResponse.getData() != null) {
orderPageVO.setVehicalNumberPlat(restResponse.getData().getNumberPlate());
}
}
}
return new ObjectRestResponse<>().data(pageDataVO); return new ObjectRestResponse<>().data(pageDataVO);
} }
......
package com.xxfc.platform.order.rest; package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.BaseOrderBiz; import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.OrderUserLicenseBiz; import com.xxfc.platform.order.biz.OrderUserLicenseBiz;
import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz; import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz;
import com.xxfc.platform.order.entity.BaseOrder; import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.entity.OrderUserLicense;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto; import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -40,77 +34,21 @@ public class OrderVehicleCrosstownController { ...@@ -40,77 +34,21 @@ public class OrderVehicleCrosstownController {
@ApiOperation(value = "添加交还车记录") @ApiOperation(value = "添加交还车记录")
@Transactional @Transactional
public ObjectRestResponse<OrderVehicleCrosstownDto> add(@RequestBody OrderVehicleCrosstownDto orderVehicleCrosstownDto) { public ObjectRestResponse<OrderVehicleCrosstownDto> add(@RequestBody OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicleCrosstownDto); return orderVehicalCrosstownBiz.add(orderVehicleCrosstownDto);
if (orderVehicleCrosstownDto == null || orderVehicleCrosstownDto.getOrderId() == null ) {
return ObjectRestResponse.createFailedResult(500, "参数为空!");
}
BaseOrder baseOrder = baseOrderBiz.selectById(orderVehicleCrosstownDto.getOrderId());
if(baseOrder == null) {
return ObjectRestResponse.createFailedResult(500,"订单不存在!");
}
List<OrderVehicaleCrosstown> oldValue = orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
if (oldValue .size() == 1) {
//已有直接返回
//交车完成 设置订单状态为出行中
if(baseOrder.getStatus() == 4) {
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
}
OrderVehicleCrosstownDto vehicleCrosstownDto = new OrderVehicleCrosstownDto();
BeanUtil.copyProperties(oldValue.get(0), vehicleCrosstownDto, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
List<OrderUserLicense> orderUserLicenses = orderUserLicenseBiz.selectByIds(oldValue.get(0).getUserLicenseId()).getData();
if(orderUserLicenses != null && orderUserLicenses.size() > 0) {
orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getLicenseIdCard());
orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getLicenseImg());
orderVehicleCrosstownDto.setLicenseName(orderUserLicenses.get(0).getLicenseName());
orderVehicleCrosstownDto.setLicensePhone(orderUserLicenses.get(0).getLicensePhone());
}
return ObjectRestResponse.succ(vehicleCrosstownDto);
} else if(oldValue .size() <= 0) {
getOrderLicense(orderVehicleCrosstownDto);
orderVehicalCrosstownBiz.insertSelective(orderVehicleCrosstownDto);
//交车完成 设置订单状态为出行中
if(baseOrder.getStatus() == 4) {
baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
}
return ObjectRestResponse.succ(orderVehicleCrosstownDto);
}
return ObjectRestResponse.createDefaultFail();
} }
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiOperation(value = "查询记录信息") @ApiOperation(value = "查询记录信息")
public ObjectRestResponse<OrderVehicaleCrosstown> get(@PathVariable Integer id) { public ObjectRestResponse<OrderVehicleCrosstown> get(@PathVariable Integer id) {
return ObjectRestResponse.succ(orderVehicalCrosstownBiz.get(id)); return ObjectRestResponse.succ(orderVehicalCrosstownBiz.get(id));
} }
@GetMapping(value = "/getByOrderId") @GetMapping(value = "/getByOrderId")
@ApiOperation(value = "根据订单Id获取所有记录信息") @ApiOperation(value = "根据订单Id获取所有记录信息")
public ObjectRestResponse<List<OrderVehicaleCrosstown>> getByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) { public ObjectRestResponse<List<OrderVehicleCrosstown>> getByOrderId(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
if (orderVehicleCrosstownDto == null) { if (orderVehicleCrosstownDto == null) {
return ObjectRestResponse.createFailedResult(500, "参数orderId为空"); return ObjectRestResponse.createFailedResult(500, "参数orderId为空");
} }
return ObjectRestResponse.succ(orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto)); return ObjectRestResponse.succ(orderVehicalCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto));
} }
public void getOrderLicense(OrderVehicleCrosstownDto orderVehicleCrosstownDto) {
OrderUserLicense orderUserLicense = new OrderUserLicense();
orderUserLicense.setLicenseIdCard(orderVehicleCrosstownDto.getLicenseIdCard());
orderUserLicense.setLicenseImg(orderVehicleCrosstownDto.getLicenseImg());
orderUserLicense.setLicenseName(orderVehicleCrosstownDto.getLicenseName());
orderUserLicense.setLicensePhone(orderVehicleCrosstownDto.getLicensePhone());
if(orderUserLicense != null) {
Integer id = orderUserLicenseBiz.add(orderUserLicense).getData().getId();
orderVehicleCrosstownDto.setUserLicenseId(id + "");
}
}
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</plugin> </plugin>
<jdbcConnection driverClass="com.mysql.jdbc.Driver" <jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://10.5.52.3:3306/xxfc_third_platform?useUnicode=true&amp;characterEncoding=UTF8" connectionURL="jdbc:mysql://10.5.52.3:3306/xxfc_activity?useUnicode=true&amp;characterEncoding=UTF8"
userId="root" userId="root"
password="sslcloud123*()"> password="sslcloud123*()">
</jdbcConnection> </jdbcConnection>
...@@ -37,7 +37,10 @@ ...@@ -37,7 +37,10 @@
<!-- </table>--> <!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>--> <!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>--> <!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table tableName="dictionary" domainObjectName="Dictionary"></table> <table tableName="integral_rule" domainObjectName="IntegralRule"></table>
<!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>--> <table tableName="integral_sign_record" domainObjectName="IntegralSignRecord"></table>
<table tableName="integral_user_total" domainObjectName="IntegralUserTotal"></table>
<table tableName="integral_user_record" domainObjectName="IntegralUserRecord"></table>
<!-- <table tableName="integeral_user_record" domainObjectName="VehicleUpkeepLog"></table>-->
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper"> <mapper namespace="com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper">
<resultMap id="BaseResultMap" type="com.xxfc.platform.order.entity.OrderVehicaleCrosstown"> <resultMap id="BaseResultMap" type="com.xxfc.platform.order.entity.OrderVehicleCrosstown">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
......
...@@ -6,12 +6,11 @@ import com.alipay.api.AlipayApiException; ...@@ -6,12 +6,11 @@ import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient; import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConstants; import com.alipay.api.AlipayConstants;
import com.alipay.api.DefaultAlipayClient; import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayTradeAppPayModel; import com.alipay.api.domain.*;
import com.alipay.api.internal.util.AlipaySignature; import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.AlipayFundAuthOrderFreezeRequest; import com.alipay.api.request.*;
import com.alipay.api.request.AlipayTradeAppPayRequest; import com.alipay.api.response.*;
import com.alipay.api.response.AlipayFundAuthOrderFreezeResponse; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.alipay.api.response.AlipayTradeAppPayResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.HTTPSUtils; import com.github.wxiaoqi.security.common.util.HTTPSUtils;
import com.github.wxiaoqi.security.common.util.OrderUtil; import com.github.wxiaoqi.security.common.util.OrderUtil;
...@@ -19,6 +18,8 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode; ...@@ -19,6 +18,8 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.entity.OrderPay;
import com.xxfc.platform.universal.mapper.OrderPayMapper;
import com.xxfc.platform.universal.vo.OrderPayVo; import com.xxfc.platform.universal.vo.OrderPayVo;
import com.xxfc.platform.universal.weixin.api.WXPay; import com.xxfc.platform.universal.weixin.api.WXPay;
import com.xxfc.platform.universal.weixin.util.HTTPUtils; import com.xxfc.platform.universal.weixin.util.HTTPUtils;
...@@ -27,9 +28,6 @@ import org.apache.commons.beanutils.BeanUtils; ...@@ -27,9 +28,6 @@ import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
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 com.xxfc.platform.universal.entity.OrderPay;
import com.xxfc.platform.universal.mapper.OrderPayMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -183,7 +181,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -183,7 +181,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
//切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。 //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
//boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type) //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type)
try { try {
boolean flag = AlipaySignature.rsaCheckV1(params, "", AlipayConstants.CHARSET_UTF8, AlipayConstants.SIGN_TYPE_RSA2); boolean flag = AlipaySignature.rsaCheckV1(params, SystemConfig.ALIPAY_PUBLIC_KEY, AlipayConstants.CHARSET_UTF8, AlipayConstants.SIGN_TYPE_RSA2);
if (!flag) { if (!flag) {
log.info("alipay order rsaCheckV1 fail, result={}", msg); log.info("alipay order rsaCheckV1 fail, result={}", msg);
return ObjectRestResponse.createDefaultFail().getMessage(); return ObjectRestResponse.createDefaultFail().getMessage();
...@@ -231,8 +229,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -231,8 +229,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
* @return * @return
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private ObjectRestResponse generateAliPayment(String orderCode, String description, String payType, Integer amount private ObjectRestResponse generateAliPayment(String orderCode, String description, String payType, Integer amount) {
) {
BigDecimal realAmount = new BigDecimal(amount.toString()).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_UP); BigDecimal realAmount = new BigDecimal(amount.toString()).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_UP);
String notifyUrl =SystemConfig.weixinHost + "/service/payment/notify/alipay"; String notifyUrl =SystemConfig.weixinHost + "/service/payment/notify/alipay";
...@@ -242,70 +239,141 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -242,70 +239,141 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
AlipayConstants.CHARSET_UTF8, SystemConfig.ALIPAY_PUBLIC_KEY, AlipayConstants.SIGN_TYPE_RSA2); AlipayConstants.CHARSET_UTF8, SystemConfig.ALIPAY_PUBLIC_KEY, AlipayConstants.SIGN_TYPE_RSA2);
//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
// //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 //// //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
//model.setBody("我是测试数据"); // //model.setBody("我是测试数据");
model.setSubject(description); // model.setSubject(description);
model.setOutTradeNo(orderCode); // model.setOutTradeNo(orderCode);
model.setTimeoutExpress("30m"); // model.setTimeoutExpress("30m");
model.setTotalAmount(realAmount.toString()); // model.setTotalAmount(realAmount.toString());
model.setProductCode("QUICK_MSECURITY_PAY"); // model.setProductCode("QUICK_MSECURITY_PAY");
request.setBizModel(model); // request.setBizModel(model);
request.setNotifyUrl(notifyUrl); // request.setNotifyUrl(notifyUrl);
try{
return fundAuthOrderAppFreeze(alipayClient);
}catch (Exception e){
e.printStackTrace();
}
// AlipayFundAuthOrderFreezeRequest request = new AlipayFundAuthOrderFreezeRequest();
// String contentString = "{" +
// "\"auth_code\":\"" + orderCode + "\"," +
// "\"auth_code_type\":\"bar_code\"," +
// "\"out_order_no\":\"8077735255938023\"," +
// "\"out_request_no\":\"8077735255938032\"," +
// "\"order_title\":\"预授权冻结\"," +
// "\"amount\":0.01," +
// "\"payee_logon_id\":\"" + SystemConfig.ALIPAY_ACOUNT + "\"," +
// "\"payee_user_id\":\"" + SystemConfig.ALIPAY_PID + "\"," +
// "\"pay_timeout\":\"2d\"," +
// "\"extra_param\":\"{\\\"secondaryMerchantId\\\":\\\"17320004886\\\"}\"," +
// "\"product_code\":\"PRE_AUTH\"" ;
// log.info("content = {}", contentString);
// request.setBizContent(contentString);
// AlipayFundAuthOrderFreezeResponse response;
// try {
// response = alipayClient.execute(request);
// if(response.isSuccess()){
// System.out.println("调用成功");
// Map<String, Object> rt = new HashMap<>();
// rt.put("payType", payType);
// rt.put("payData", response.getBody());
// return ObjectRestResponse.succ(rt);
// } else {
// System.out.println("调用失败");
// }
// } catch (AlipayApiException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// try {
// //这里和普通的接口调用不同,使用的是sdkExecute
// AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
// System.out.println(response.getBody());//就是orderString 可以直接给客户端请求,无需再做处理。
// Map<String, Object> rt = new HashMap<>();
// rt.put("payType", payType);
// rt.put("payData", response.getBody());
// return ObjectRestResponse.succ(rt);
// } catch (AlipayApiException e) {
// e.printStackTrace();
// }
return ObjectRestResponse.createDefaultFail();
}
//预授权冻结
public ObjectRestResponse fundAuthOrderAppFreeze(AlipayClient alipayClient) throws AlipayApiException {
AlipayFundAuthOrderAppFreezeRequest request = new AlipayFundAuthOrderAppFreezeRequest();
String notifyUrl =SystemConfig.weixinHost + "/service/payment/notify/alipay";
AlipayFundAuthOrderAppFreezeModel model = new AlipayFundAuthOrderAppFreezeModel();
model.setOrderTitle("支付宝预授权");
model.setOutOrderNo("2018077735255938023");//替换为实际订单号
model.setOutRequestNo("2018077735255938232");//替换为实际请求单号,保证每次请求都是唯一的
model.setPayeeUserId(SystemConfig.APP_ID);//payee_user_id,Payee_logon_id不能同时为空
model.setPayeeLogonId("Payee_logon_id");
model.setProductCode("PRE_AUTH_ONLINE");//PRE_AUTH_ONLINE为固定值,不要替换
model.setAmount("0.02");
//需要支持信用授权,该字段必传
//model.setExtraParam("{\"category\":\"xxx\",\"outStoreCode\":\"charge001\",\"outStoreAlias\":\"充电桩北京路点\"}"); //outStoreAlias将在用户端信用守护、支付信息、账单详情页展示
//选填字段,指定支付渠道
//model.setEnablePayChannels("[{\"payChannelType\":\"PCREDIT_PAY\"},{\"payChannelType\":\"MONEY_FUND\"},{\"payChannelType\":\"CREDITZHIMA\"}]");
request.setBizModel(model);
try { request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
//这里和普通的接口调用不同,使用的是sdkExecute AlipayFundAuthOrderAppFreezeResponse response = alipayClient.sdkExecute(request);//注意这里是sdkExecute,可以获取签名参数
AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); if(response.isSuccess()){
System.out.println(response.getBody());//就是orderString 可以直接给客户端请求,无需再做处理。 System.out.println("调用成功");
log.info("response: {}"+response.getBody());//签名后的参数,直接入参到
return ObjectRestResponse.succ(response.getBody());
} else {
System.out.println("调用失败");
return ObjectRestResponse.createDefaultFail();
}
}
//解冻预授权
public void fundAuthOrderUnFreeze(AlipayClient alipayClient) throws AlipayApiException {
String notifyUrl =SystemConfig.weixinHost + "/service/payment/notify/alipay";
AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();
AlipayFundAuthOrderUnfreezeModel model = new AlipayFundAuthOrderUnfreezeModel();
model.setAuthNo("2017120410002001390208978986"); // 支付宝资金授权订单号,在授权冻结成功时返回需要入库保存
model.setOutRequestNo("UnfreezeRequestNo000003");//同一商户每次不同的资金操作请求,商户请求流水号不能重复,且与冻结流水号不同
model.setAmount("0.01"); // 本次操作解冻的金额,单位为:元(人民币),精确到小数点后两位
model.setRemark("预授权解冻"); // 商户对本次解冻操作的附言描述,长度不超过100个字母或50个汉字
//选填字段,信用授权订单,针对信用全免订单,传入该值完结信用订单,形成芝麻履约记录
// model.setExtraParam("{\"unfreezeBizInfo\":\"{\\\"bizComplete\\\":\\\"true\\\"}\"}");
request.setBizModel(model);
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
log.info("alipay result={}", response.getMsg()); AlipayFundAuthOrderUnfreezeResponse response = alipayClient.execute(request);
log.info("alipay result={}", response.getCode()); log.info("response: {}"+response.getBody());
log.info("alipay result={}", response.getBody()); }
//取消预授权
public void fundAuthCancel() throws AlipayApiException {
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2");
AlipayFundAuthOperationCancelRequest request = new AlipayFundAuthOperationCancelRequest();
AlipayFundAuthOperationCancelModel model = new AlipayFundAuthOperationCancelModel();
//model.setAuthNo("2017120110002001390206804295"); // 支付宝资金授权订单号,在授权冻结成功时返回参数中获得
model.setOutOrderNo("orderFreeze000005"); //商户的授权资金订单号,与支付宝的授权资金订单号不能同时为空
//model.setOperationId("20171201317348823902"); //支付宝的授权资金操作流水号
model.setOutRequestNo("requestNo000005");//与支付宝的授权资金操作流水号不能同时为空,与冻结流水号相同
model.setRemark("预授权撤销"); // 商户对本次撤销操作的附言描述,长度不超过100个字母或50个汉字
request.setBizModel(model);
request.setNotifyUrl("");//异步通知地址,必填,该接口只通过该参数进行异步通知
Map<String, Object> rt = new HashMap<>(); AlipayFundAuthOperationCancelResponse response = alipayClient.execute(request);
rt.put("payType", payType); log.info("response: {}"+response.getBody());
rt.put("payData", response.getBody());
return ObjectRestResponse.succ(rt);
} catch (AlipayApiException e) {
e.printStackTrace();
}
return ObjectRestResponse.createDefaultFail();
} }
//预授权转支付
public void tradePay() throws AlipayApiException {
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","utf-8","alipay_public_key","RSA2");
AlipayTradePayRequest request = new AlipayTradePayRequest();
AlipayTradePayModel model = new AlipayTradePayModel();
model.setOutTradeNo("20180412100020088982"); // 预授权转支付商户订单号,为新的商户交易流水号;如果重试发起扣款,商户订单号不要变;
model.setProductCode("PRE_AUTH_ONLINE"); // 固定值PRE_AUTH_ONLINE
model.setAuthNo("2018041210002001660228733635"); // 填写预授权冻结交易号
model.setSubject("预授权转支付测试"); // 解冻转支付标题,用于展示在支付宝账单中
model.setTotalAmount("0.01"); // 结算支付金额
model.setSellerId(SystemConfig.ALIPAY_PID); // 填写卖家支付宝账户pid
model.setBuyerId(SystemConfig.ALIPAY_APPID); // 填写预授权用户uid,通过预授权冻结接口返回的payer_user_id字段获取
model.setStoreId("test_store_id"); // 填写实际交易发生的终端编号,与预授权的outStoreCode保持一致即可
model.setBody("预授权解冻转支付测试"); // 可填写备注信息
//如果需要从一笔授权中完成多笔订单支付,保持auth_no不变,不同订单根据outTradeNo进行标识,此时auth_confirm_mode不传或者传入NOT_COMPLETE;进行到最后一笔转支付时,auth_confirm_mode传入COMPLETE由支付宝完成剩余金额自动解冻,或者商户自行调用解冻接口将剩余金额解冻。
model.setAuthConfirmMode("COMPLETE");//必须使用COMPLETE,传入该值用户剩余金额会自动解冻
request.setBizModel(model);
request.setNotifyUrl("");//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayTradePayResponse response = alipayClient.execute(request);
if(response.isSuccess()){
System.out.println("调用成功");
log.info("response: {}"+response.getBody());
} else {
System.out.println("调用失败");
}
}
//退款
public void testTradeRefund() throws Exception {
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2");
AlipayTradeRefundModel model = new AlipayTradeRefundModel();
model.setOutTradeNo("tradePay000002"); //与预授权转支付商户订单号相同,代表对该笔交易退款
model.setRefundAmount("0.01");
model.setRefundReason("预授权退款测试");
model.setOutRequestNo("refund0000001");//标识一次退款请求,同一笔交易多次退款需要保证唯一,如部分退款则此参数必传。
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
request.setBizModel(model);
AlipayTradeRefundResponse response = alipayClient.execute(request);
log.info("response: {}"+response.getBody());
}
public ObjectRestResponse generatePayment(String orderCode, String description, String payType, Integer amount public ObjectRestResponse generatePayment(String orderCode, String description, String payType, Integer amount
) { ) {
ObjectRestResponse objectRestResponse = ObjectRestResponse.createDefaultFail(); ObjectRestResponse objectRestResponse = ObjectRestResponse.createDefaultFail();
......
...@@ -88,7 +88,7 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> { ...@@ -88,7 +88,7 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
return baseBiz.alipayNotify(); return baseBiz.alipayNotify();
} }
@PostMapping(value = "/app/generate_payment") @GetMapping(value = "/app/generate_payment")
public Object generatePayment(@RequestParam("orderCode") String orderCode, @RequestParam("description") String description, public Object generatePayment(@RequestParam("orderCode") String orderCode, @RequestParam("description") String description,
@RequestParam("payType") String payType, @RequestParam("amount") Integer amount) { @RequestParam("payType") String payType, @RequestParam("amount") Integer amount) {
Object resp = baseBiz.generatePayment(orderCode, description, payType, amount); Object resp = baseBiz.generatePayment(orderCode, description, payType, amount);
......
...@@ -4,9 +4,11 @@ import lombok.Data; ...@@ -4,9 +4,11 @@ import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date; import java.util.Date;
@Data @Data
@Table(name = "vehicle")
public class Vehicle { public class Vehicle {
/** /**
* 主键(uuid) * 主键(uuid)
......
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